@WebSocket public final class WebSocketHandlerWrapper extends Object
Constructor and Description |
---|
WebSocketHandlerWrapper(WebSocketSessionManager sessionManager,
WebSocketHandler delegateHandler)
Creates a
WebSocketHandlerWrapper instance. |
Modifier and Type | Method and Description |
---|---|
void |
onWebSocketBinary(org.eclipse.jetty.websocket.api.Session session,
byte[] payload,
int offset,
int length)
Called when a client sends a binary message.
|
void |
onWebSocketClose(org.eclipse.jetty.websocket.api.Session session,
int statusCode,
String reason)
Called when a client disconnects.
|
void |
onWebSocketConnect(org.eclipse.jetty.websocket.api.Session session)
Called when a client connects.
|
void |
onWebSocketError(org.eclipse.jetty.websocket.api.Session session,
Throwable cause)
Called when a WebSocket error occurs.
|
void |
onWebSocketText(org.eclipse.jetty.websocket.api.Session session,
String message)
Called when a client sends a text message.
|
public WebSocketHandlerWrapper(WebSocketSessionManager sessionManager, WebSocketHandler delegateHandler)
WebSocketHandlerWrapper
instance.sessionManager
- the session manager which tracks the currently open WebSocket
sessionsdelegateHandler
- the user defined handler which actually handles the event@OnWebSocketConnect public void onWebSocketConnect(org.eclipse.jetty.websocket.api.Session session) throws IOException
session
- the WebSocket sessionIOException
- if an I/O error occurs in the handler@OnWebSocketMessage public void onWebSocketText(org.eclipse.jetty.websocket.api.Session session, String message) throws IOException
session
- the WebSocket sessionmessage
- the messageIOException
- if an I/O error occurs in the handler@OnWebSocketMessage public void onWebSocketBinary(org.eclipse.jetty.websocket.api.Session session, byte[] payload, int offset, int length) throws IOException
session
- the WebSocket sessionpayload
- the raw payload arrayoffset
- the offset in the payload array where the data startslength
- the length of bytes in the payloadIOException
- if an I/O error occurs in the handler@OnWebSocketClose public void onWebSocketClose(org.eclipse.jetty.websocket.api.Session session, int statusCode, String reason) throws IOException
session
- the WebSocket sessionstatusCode
- the close status codereason
- the optional reason for the closeIOException
- if an I/O error occurs in the handler@OnWebSocketError public void onWebSocketError(org.eclipse.jetty.websocket.api.Session session, Throwable cause) throws IOException
session
- the WebSocket sessioncause
- the cause of the errorIOException
- if an I/O error occurs in the handlerCopyright © 2020. All rights reserved.