WebSocket Options

Crossbar.io is built on an advanced and complete WebSocket implementation that exposes various options and tunables you might be interested in, especially if you take your server to production.

For options related to WebSocket compression, please see here.

To set options on a WebSocket transport, add an options dictionary to the transport configuration part. Here is an example:

   "type": "websocket",
   "endpoint": {
      "type": "tcp",
      "port": 8080
   "url": "ws://localhost:8080",
   "options": {
      "enable_webstatus": false

Above will run a WebSocket transport, but disable the automatic rendering of a server status page when the WebSocket server is accessed from a regular Web client that does not upgrade to WebSocket.

Available Options

The available options are:




A list of allowed WebSocket origins - can use * as a wildcard character, e.g. [“https://*.tavendo.com”, “http://localhost:8080”]


The external visible port this service be reachable under (i.e. when running behind a L2/L3 forwarding device) (default: null)


Enable Hybi-10 version of WebSocket (an intermediary spec). (default: true)


Enable RFC6455 version of WebSocket (the final spec). (default: true)


Enable the WebSocket server’s status rendering page. (default: true)


Validate incoming WebSocket text messages for UTF8 conformance. (default: true)


Mask server-sent WebSocket frames. WARNING: Enabling this will break protocol compliance! (default: false)


Require all WebSocket frames received to be masked. (default: true)


Actually apply WebSocket masking (both in- and outgoing). (default: true)


Maximum size in bytes of incoming WebSocket frames accepted or 0 to allow any size. (default: 0)


Maximum size in bytes of incoming WebSocket messages accepted or 0 to allow any size. (default: 0)


Automatically fragment outgoing WebSocket messages into WebSocket frames of payload maximum specified size in bytes or 0 to disable. (default: 0)


On severe errors (like WebSocket protocol violations), brutally drop the TCP connection instead of performing a full WebSocket closing handshake. (default: false)


During a WebSocket closing handshake initiated by a peer, echo the peer’s close code and reason. Otherwise reply with code 1000 and no reason. (default: false)


WebSocket opening handshake timeout in ms or 0 to disable. (default: 0)


WebSocket closing handshake timeout in ms or 0 to disable. (default: 0)


Set the TCP No-Delay (“Nagle”) socket option (default: true)


Send a WebSocket ping every this many ms or 0 to disable. (default: 0)


Drop the connection if the peer did not respond to a previously sent ping in this many ms or 0 to disable. (default: 0)


Payload size for pings sent, must be between 4 and 125 (default: 4)


enable WebSocket compression - see WebSocket Compression


Require WebSocket clients to properly announce the WAMP-WebSocket subprotocols it is able to speak This can be one or more from wamp.2.json, wamp.2.msgpack, wamp.2.json.batched and wamp.2.json.batched. Crossbar.io will by default require the client to announce the subprotocols it supports and select one of the announced subprotocols. If this option is set to false, Crossbar.io will no longer require the client to announce subprotocols and assume wamp.2.json when no WebSocket subprotocol is announced. (default: true)

Production Settings

For example, here is a configuration for a production WebSocket service with conservative settings:

   "type": "websocket",
   "endpoint": {
      "type": "tcp",
      "port": 8080
   "url": "ws://myserver.com:8080",
   "options": {
      "enable_webstatus": false,
      "max_frame_size": 1048576,
      "max_message_size": 1048576,
      "auto_fragment_size": 65536,
      "fail_by_drop": true,
      "open_handshake_timeout": 2500,
      "close_handshake_timeout": 1000,
      "auto_ping_interval": 10000,
      "auto_ping_timeout": 5000,
      "auto_ping_size": 4