public static class WebSocketResponse.Accept extends WebSocketResponse implements AutoAsync<WebSocketResponse>
The Accept response contains a channelHandler
that will operate on the WebSocket channel created after handshake.
Note that this class is a subtype of Async<WebSocketResponse>
.
WebSocketResponse.Accept, WebSocketResponse.Reject
Constructor and Description |
---|
Accept(String subprotocol,
FunctionX<WebSocketChannel,Async<?>> channelHandler)
Create an Accept response.
|
Instance Methods | |
---|---|
FunctionX<WebSocketChannel,Async<?>> |
getChannelHandler()
The channelHandler.
|
String |
getSubprotocol()
The subprotocol selected.
|
accept, reject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, isCompleted, onCompletion, pollResult, timeout
public Accept(String subprotocol, FunctionX<WebSocketChannel,Async<?>> channelHandler)
public FunctionX<WebSocketChannel,Async<?>> getChannelHandler()
After a WebSocket handshake is accepted, the server creates a WebSocketChannel and feed it to this channelHandler.
The channelHandler is invoked in a Fiber created for the channel. The Fiber completes when the Async<?> returned by the channelHandler completes.
public String getSubprotocol()
If non-null, it must be one of the subprotocols presented in the handshake request.