WebSocket
Plaintext#
import serve, serve/reactor
serveWsReactor(8080, wsHandler)See reactor_ws.nim — "async WebSocket (RFC 6455) server on the reactor."
Over TLS (wss://)#
serveWssReactor(8443, tlsContext, wsHandler)HTTPS and wss:// share one connection body on the reactor — see reactor_wss.nim, which notes the design directly: "one connection body for both transports."
Streaming and backpressure#
A stream producer on a WebSocket connection can pace itself, and a connection that spins without making progress gets cut rather than left to leak resources indefinitely — see reactor_stream.nim.
Conformance#
WebSocket support is checked against Autobahn-grade conformance testing — the same reference suite used to validate WebSocket implementations across languages, not an internal-only test set.
Related#
- The reactor
- HTTP/1.1 — WebSocket upgrades from an HTTP/1.1 handshake
- HTTP/3 and QUIC — WebTransport as the QUIC-native alternative
