WebSocketHandler

A special HttpRequestHandler implementation that exclusively handles websocket connection handshakes.

Constructors

this
this(WebSocketMessageHandler messageHandler)

Constructs the websocket handler using the given message handler for any websocket messages received via this handler.

Members

Functions

handle
void handle(HttpRequestContext ctx)

Handles an HTTP request by verifying that it's a legitimate websocket request, then sends a 101 SWITCHING PROTOCOLS response, and finally, registers a new websocket connection with the server's manager. If an invalid request is given, then a client error response code will be sent back.

Inherited Members

From HttpRequestHandler

handle
void handle(HttpRequestContext ctx)

Handles an HTTP request. Note that this method may be called from multiple threads, as requests may be processed in parallel, so you should avoid performing actions which are not thread-safe.