uCon HomePage

HTTP Server

uCon supports remote access of the console window over HTTP. 

NEW as of Feb 2018: basic RESTful interface (see below)

The menu item Servers->HTTP brings up the following dialog box:

The server's port and home directory can be adjusted.  The default installation points to the default home directory with an index.html and a few image files that create the default page (below).  With a little bit of javascript tweaking, you can customize your own page as you see fit (see example below).  Or, if useful, you can simply point the Home path (in the dialog above) to some directory on your pc and use it as a basic web page server.

The default  page (based on $INSTALLDIR/http/index.html) looks like this:

One immediately interesting use for this is for those that like a lot of programmable buttons.  
With a few tweeks to the index.html page that comes with the installation, you can do this...
(you can add as many pre-programmed buttons as you like).

Customizing the pages:
The most important thing to note in the server is that you can build whatever you want to build (regarding the look of the page); then just use
the javascript function docmd(ln) to send the string to the target through websockets.

SSI (kinda):
The server supports some "SSI-ish" style phrases within the .html files served.  Referring to the default index.html file that comes with this distribution, you can see the following:


Within that string there can be normal text or variable from uCon.  
The variables are parsed as ${VARNAME[:DEFAULT]} (where DEFAULT is used if VARNAME does not exist); so referring to index.html, the line within the javascript code that initiates the websocket connection is:

websock = new WebSocket("ws://<!--#echo:${MYIP}-->:50080");

which, after being processed by the server would be:

websock = new WebSocket("ws://");

where "" is the IP address of the machine uCon is running on.

There are a few others supported...
  • <!--#title-->
Is replaced with whatever text is being displayed in uCon's title bar.
  • <!--#flbl${N:DEF}-->
Is replaced with function key label 'N', or "DEF" if there is no label.
  • <!--#blbl${N:DEF}-->
Is replaced with button label 'N', or "DEF" if there is no label.
  • <!--#include virtual="filename_goes_here"-->
Is replaced with the content of the file filename_goes_here

RESTful interface:
With the HTTP server enabled, you can now issue RESTful commands through a web browser...
  • http://IP_ADDRESS:PORT/UCON?FKEY=F                     (2 <=F <= 9)
  • http://IP_ADDRESS:PORT/UCON?BUTTON=B                   (1 <=B <= 16)
  • http://IP_ADDRESS:PORT/UCON?SCRCMD=command_goes_here