Skip to content

Command line options

Bradley Curran edited this page Feb 1, 2019 · 2 revisions
Usage of websocketd:
  -address value
    	Interfaces to bind to (e.g. 127.0.0.1 or [::1]).
  -binary
    	Set websocketd to experimental binary mode (default is line by line)
  -cgidir string
    	Serve CGI scripts from this directory over HTTP
  -closems uint
    	Time to start sending signals (0 never)
  -devconsole
    	Enable development console (cannot be used in conjunction with --staticdir)
  -dir string
    	Base directory for WebSocket scripts
  -header value
    	Custom headers for any response.
  -header-http value
    	Custom headers for all but WebSocket upgrade HTTP responses.
  -header-ws value
    	Custom headers for successful WebSocket upgrade responses.
  -license
    	Print license and exit
  -loglevel string
    	Log level, one of: debug, trace, access, info, error, fatal (default "access")
  -maxforks int
    	Max forks, zero means unlimited
  -origin string
    	Restrict upgrades if origin does not match the list
  -passenv string
    	List of envvars to pass to subprocesses (others will be cleaned out) (default "PATH,DYLD_LIBRARY_PATH")
  -port int
    	HTTP port to listen on
  -redirport int
    	HTTP port to redirect to canonical --port address
  -reverselookup
    	Perform reverse DNS lookups on remote clients
  -sameorigin
    	Restrict upgrades if origin and host headers differ
  -ssl
    	Use TLS on listening socket (see also --sslcert and --sslkey)
  -sslcert string
    	Should point to certificate PEM file when --ssl is used
  -sslkey string
    	Should point to certificate private key file when --ssl is used
  -staticdir string
    	Serve static content from this directory over HTTP
  -version
    	Print version and exit
websocketd (0.3.0 (go1.9.2 darwin-amd64) --)

websocketd is a command line tool that will allow any executable program
that accepts input on stdin and produces output on stdout to be turned into
a WebSocket server.

Usage:

  Export a single executable program a WebSocket server:
    websocketd [options] COMMAND [command args]

  Or, export an entire directory of executables as WebSocket endpoints:
    websocketd [options] --dir=SOMEDIR

Options:

  --port=PORT                    HTTP port to listen on.

  --address=ADDRESS              Address to bind to (multiple options allowed)
                                 Use square brackets to specify IPv6 address.
                                 Default: "" (all)

  --sameorigin={true,false}      Restrict (HTTP 403) protocol upgrades if the
                                 Origin header does not match to requested HTTP
                                 Host. Default: false.

  --origin=host[:port][,host[:port]...]
                                 Restrict (HTTP 403) protocol upgrades if the
                                 Origin header does not match to one of the host
                                 and port combinations listed. If the port is not
                                 specified, any port number will match.
                                 Default: "" (allow any origin)

  --ssl                          Listen for HTTPS socket instead of HTTP.
  --sslcert=FILE                 All three options must be used or all of
  --sslkey=FILE                  them should be omitted.

  --redirport=PORT               Open alternative port and redirect HTTP traffic
                                 from it to canonical address (mostly useful
                                 for HTTPS-only configurations to redirect HTTP
                                 traffic)

  --passenv VAR[,VAR...]         Lists environment variables allowed to be
                                 passed to executed scripts. Does not work for
																 Windows since all the variables are kept there.

  --binary={true,false}          Switches communication to binary, process reads
                                 send to browser as blobs and all reads from the
                                 browser are immediately flushed to the process.
                                 Default: false

  --reverselookup={true,false}   Perform DNS reverse lookups on remote clients.
                                 Default: false

  --dir=DIR                      Allow all scripts in the local directory
                                 to be accessed as WebSockets. If using this,
                                 option, then the standard program and args
                                 options should not be specified.

  --staticdir=DIR                Serve static files in this directory over HTTP.

  --cgidir=DIR                   Serve CGI scripts in this directory over HTTP.

  --maxforks=N                   Limit number of processes that websocketd is
                                 able to execute with WS and CGI handlers.
                                 When maxforks reached the server will be
                                 rejecting requests that require executing
                                 another process (unlimited when 0 or negative).
                                 Default: 0

  --closems=milliseconds         Specifies additional time process needs to gracefully
                                 finish before websocketd will send termination signals
                                 to it. Default: 0 (signals sent after 100ms, 250ms,
                                 and 500ms of waiting)

  --header="..."                 Set custom HTTP header to each answer. For
                                 example: --header="Server: someserver/0.0.1"

  --header-ws="...."             Same as --header, just applies to only those
                                 responses that indicate upgrade of TCP connection
                                 to a WebSockets protocol.

  --header-http="...."           Same as --header, just applies to only to plain
                                 HTTP responses that do not indicate WebSockets
                                 upgrade


  --help                         Print help and exit.

  --version                      Print version and exit.

  --license                      Print license and exit.

  --devconsole                   Enable interactive development console.
                                 This enables you to access the websocketd
                                 server with a web-browser and use a
                                 user interface to quickly test WebSocket
                                 endpoints. For example, to test an
                                 endpoint at ws://[host]/foo, you can
                                 visit http://[host]/foo in your browser.
                                 This flag cannot be used in conjunction
                                 with --staticdir or --cgidir.

  --loglevel=LEVEL               Log level to use (default access).
                                 From most to least verbose:
                                 debug, trace, access, info, error, fatal

Full documentation at http://websocketd.com/

Copyright 2013 Joe Walnes and the websocketd team. All rights reserved.
BSD license: Run 'websocketd --license' for details.

See help.go

Clone this wiki locally