Package io.karatelabs.http
Interface WsHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler for WebSocket upgrade requests.
Called when a client sends an HTTP request with "Upgrade: websocket".
The handler receives the original HTTP request and an open WebSocket connection.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(HttpRequest request, WsConnection connection) Handle a WebSocket connection after the upgrade handshake completes.
-
Method Details
-
accept
Handle a WebSocket connection after the upgrade handshake completes. This method is called on a Netty worker thread. Implementations should register message callbacks on the connection and return promptly.- Parameters:
request- the HTTP request that initiated the WebSocket upgradeconnection- the WebSocket connection for sending and receiving messages
-