Reference

Exact answers about what websocketd does. Every command line flag and its default, every environment variable a spawned process receives, every exit code the binary returns, what --devconsole serves, which platforms are built and released, and what ships in the repository's examples/ directory.

One rule applies to every flag rather than to any single one.

Flag placement

Every websocketd flag must come before COMMAND on the command line, or before --dir, --staticdir, or --cgidir when one of those is used instead of a command.

websocketd --port=8080 --header=X-Trace:1 ./myscript.sh

websocketd parses its command line with Go's standard flag package, which stops parsing at the first argument that is not a flag. That argument is COMMAND. Everything after it is passed through to the wrapped program as its own argument, unexamined.

So this passes --header=X-Trace:1 to myscript.sh and sets no header at all:

websocketd --port=8080 ./myscript.sh --header=X-Trace:1

websocketd reports no error in that case, because a wrapped program is entitled to any arguments you give it. The flag is simply never applied. This has been reported several times as --header not working (issues #151, #155). It applies to every flag, not only the header flags.

Pages

  • CLI flags lists every flag, its default, and its exact effect.
  • Environment variables lists every variable a spawned process receives, and which of them the client controls.
  • Exit codes gives every code websocketd returns and what triggers it.
  • Dev console covers what --devconsole serves and the contract its response follows.
  • Platform support names the released platforms, and what differs on Windows.
  • Examples covers what ships in examples/, per language, and the command to run each one.

For the reasoning behind any of it, see the process model , message framing , and the security model . To wrap a script for the first time, start with the tutorial .

  • CLI flags — Every websocketd command line flag, its default, and exactly what it does.
  • Environment variables — Every environment variable websocketd sets on a spawned process, what populates it, and which ones the client controls.
  • Exit codes — Every exit code websocketd returns, what triggers it, and which stream carries the message.
  • Dev console — What --devconsole serves: the page, its mutual exclusions, and the response contract it follows.
  • Platform support — The platforms websocketd is released for, and the exact behaviour differences on Windows.
  • Examples — Every example program shipped in the repository's examples/ directory, what it does, and the command that runs it.