Skip to content

Program Flow

bgailer edited this page Jul 9, 2018 · 6 revisions

The purpose of this page is to document in more detail the flow of control in websocketd. This is from a user's perspective.

When started, the server waits for connections, which can be triggered by HTTP or WS requests.

For each connection the server starts an instance of the program specified in the websocketd command. If --staticdir is specified it will also return the file specified in the request. If file is not specified, will return index.html, if present.

The static file, if one, is returned first, then the program is run.

There seems to be a problem with the setting of some environment variables. Case in point: QUERY_STRING is always blank. A workaround is: in the web page javascript include ws.send(document.URL) where ws refers to a WebSocket instance. The server program can parse out the query string.

Clone this wiki locally