Skip to main content
Version: 0.16

WebSockets

WebSockets, described in RFC 6455, allow clients to open a two-way communication channel with a web server. Unlike HTTP, which is unidirectional and requires a new connection for each request, a WebSocket maintains a full-duplex persistent connection in which data can flow in both directions.

JMAP over WebSocket

JMAP over WebSocket is a subprotocol described in RFC 8887 that runs the JMAP protocol over a WebSocket transport layer. It delivers higher throughput than JMAP over HTTP by keeping a single persistent connection open between the client and the server, removing the per-request overhead of setting up and authenticating a new HTTP request. Clients authenticate once when the connection is established; credentials remain in effect for the lifetime of the connection.

JMAP over WebSocket is enabled by default in Stalwart and is available to JMAP clients at wss://mail.example.com.

Configuration

WebSocket behaviour is controlled by the following fields on the Jmap singleton (found in the WebUI under Settings › Network › JMAP › Limits, Settings › Network › JMAP › Push, Settings › Network › JMAP › WebSocket):

  • websocketTimeout: time after which an inactive WebSocket connection is closed. Default "10m".
  • websocketHeartbeat: interval between heartbeat packets sent to WebSocket clients. Default "1m".
  • websocketThrottle: time to wait before sending a batch of notifications to a WebSocket client. Default "1s".

Conformed RFCs