public interface WebSocketHandler
For each handshake request, the handle(WebSocketRequest)
action
generates a handshake response, either Reject or Accept.
For many applications, the handler can simply accept any request
WebSocketHandler handler = request -> WebSocketResponse.accept(this::handleChannel); Async<Void> handleChannel(WebSocketChannel channel){ ... }
Note that by default, same-origin policy is enforced before the handler is invoked,
see WebSocketServerConf.enforceSameOrigin(boolean)
.
Abstract Method | |
---|---|
Async<WebSocketResponse> |
handle(WebSocketRequest request)
Handle a WebSocket handshake request.
|
Async<WebSocketResponse> handle(WebSocketRequest request)
This action should generate either a WebSocketResponse.Reject
or a WebSocketResponse.Accept
.
This method will be invoked by the server on a Fiber created for the underlying HTTP connection.
CookieJar
can be used during this action to get/set cookies.