/ websrv

Embedded Web Server

websrv provides a simple web server for embedded applications using libwebsockets.

It simply creates a websocket server on an available port, and starts a web browser locally to point back at it. The file name given as an argument is farmed out as well as any other requested files. It also supports switching to websockets mode, wherein callback is called to receive messages (default: WebRecv()).

When the last connection is dropped, the websrv delete itself, after the timeout delay (default: 10 seconds).


websrv can be invoked directly by calling the autoload function jsi_websrv(files,opts).

port8765Port to listen on

Implementation Details

websrv is implemented entirely in javascript.

You can find the source for websrv in the jsi/lib subdirectory. For convenience, here is a link to the [42ce24f6574c88ea|websrv source from jsish 1.0.6].

Although websrv is not actually used by the demo applications ledger and sqliteui, it did serve as the model.

The source: ../lib/Jsi_Websrv.jsi