Class WsConnection
java.lang.Object
io.helidon.nima.websocket.webserver.WsConnection
- All Implemented Interfaces:
ServerConnection,WsSession
WebSocket connection, server side session implementation.
-
Method Summary
Modifier and TypeMethodDescriptionClose session.static WsConnectioncreate(ConnectionContext ctx, HttpPrologue prologue, Headers upgradeHeaders, String wsKey, WsRoute wsRoute) Create a new connection.voidhandle()Start handling the connection.ping(BufferData bufferData) Send ping.pong(BufferData bufferData) Send pong.send(BufferData bufferData, boolean last) Send binary fragment.Send text fragment.The WebSocket sub-protocol negotiated for this session.Terminate session.
-
Method Details
-
create
public static WsConnection create(ConnectionContext ctx, HttpPrologue prologue, Headers upgradeHeaders, String wsKey, WsRoute wsRoute) Create a new connection.- Parameters:
ctx- server connection contextprologue- prologue of this requestupgradeHeaders- headers forwsKey- ws keywsRoute- route to use- Returns:
- a new connection
-
handle
public void handle()Description copied from interface:ServerConnectionStart handling the connection. Data is provided throughServerConnectionSelector.connection(io.helidon.nima.webserver.ConnectionContext).- Specified by:
handlein interfaceServerConnection
-
send
Description copied from interface:WsSessionSend text fragment. -
send
Description copied from interface:WsSessionSend binary fragment. -
ping
Description copied from interface:WsSessionSend ping. -
pong
Description copied from interface:WsSessionSend pong. -
close
Description copied from interface:WsSessionClose session.- Specified by:
closein interfaceWsSession- Parameters:
code- close code, may be one ofWsCloseCodesreason- reason description- Returns:
- this instance
-
terminate
Description copied from interface:WsSessionTerminate session. Sends a close and closes the connection. -
subProtocol
Description copied from interface:WsSessionThe WebSocket sub-protocol negotiated for this session.- Specified by:
subProtocolin interfaceWsSession- Returns:
- sub-protocol negotiated, if any
-