11 lines
1.1 KiB
Markdown
11 lines
1.1 KiB
Markdown
# Handy-Http Websockets
|
|
[DDoc Reference](ddoc/websockets/index.html)
|
|
|
|
The [Websockets](https://git.andrewlalis.com/Handy-Http/websockets) component provides an [RFC-6455](https://datatracker.ietf.org/doc/html/rfc6455)-compatible implementation of server-side websockets.
|
|
|
|
You can add websocket support to your server by using the [`WebSocketRequestHandler`](ddoc/websockets/handy_http_websockets.handler.WebSocketRequestHandler.html) to handle requests that you'd like to upgrade to websockets. Typically, you'd use the [`PathHandler`](handlers.md#the-path-handler) to map requests of a particular URL, say, `GET /websocket`, to the `WebSocketRequestHandler`.
|
|
|
|
All that you need to do is define a class that extends from [`WebSocketMessageHandler`](ddoc/websockets/handy_http_websockets.components.WebSocketMessageHandler.html) to override the callback methods you'd like to deal with, and provide your message handler when constructing the `WebSocketRequestHandler`.
|
|
|
|
Check out the [example](https://git.andrewlalis.com/Handy-Http/websockets/src/branch/main/examples) available in the project's source code!
|