Interface IWebSocketConnectionHandler
-
- All Known Implementing Classes:
WebSocketConnectionHandler
public interface IWebSocketConnectionHandlerSession handler for WebSocket sessions.
-
-
Field Summary
Fields Modifier and Type Field Description static intCLOSE_CANNOT_CONNECTConnection could not be established in the first place.static intCLOSE_CONNECTION_LOSTA previously established connection was lost unexpected.static intCLOSE_INTERNAL_ERRORInternal error.static intCLOSE_NORMALConnection was closed normally.static intCLOSE_PROTOCOL_ERRORThe connection was closed because a protocol violation occurred.static intCLOSE_RECONNECTServer connection lost, scheduled reconnectstatic intCLOSE_SERVER_ERRORServer returned error while connecting
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonClose(int code, java.lang.String reason)Fired when the WebSockets connection has deceased (or could not established in the first place).voidonConnect(ConnectionResponse response)voidonMessage(byte[] payload, boolean isBinary)voidonMessage(java.lang.String payload)voidonOpen()Fired when the WebSockets connection has been established.voidonPing()voidonPing(byte[] payload)voidonPong()voidonPong(byte[] payload)voidsetConnection(WebSocketConnection connection)
-
-
-
Field Detail
-
CLOSE_NORMAL
static final int CLOSE_NORMAL
Connection was closed normally.- See Also:
- Constant Field Values
-
CLOSE_CANNOT_CONNECT
static final int CLOSE_CANNOT_CONNECT
Connection could not be established in the first place.- See Also:
- Constant Field Values
-
CLOSE_CONNECTION_LOST
static final int CLOSE_CONNECTION_LOST
A previously established connection was lost unexpected.- See Also:
- Constant Field Values
-
CLOSE_PROTOCOL_ERROR
static final int CLOSE_PROTOCOL_ERROR
The connection was closed because a protocol violation occurred.- See Also:
- Constant Field Values
-
CLOSE_INTERNAL_ERROR
static final int CLOSE_INTERNAL_ERROR
Internal error.- See Also:
- Constant Field Values
-
CLOSE_SERVER_ERROR
static final int CLOSE_SERVER_ERROR
Server returned error while connecting- See Also:
- Constant Field Values
-
CLOSE_RECONNECT
static final int CLOSE_RECONNECT
Server connection lost, scheduled reconnect- See Also:
- Constant Field Values
-
-
Method Detail
-
onConnect
void onConnect(ConnectionResponse response)
-
onOpen
void onOpen()
Fired when the WebSockets connection has been established. After this happened, messages may be sent.
-
onClose
void onClose(int code, java.lang.String reason)Fired when the WebSockets connection has deceased (or could not established in the first place).- Parameters:
code- Close code.reason- Close reason (human-readable).
-
onMessage
void onMessage(java.lang.String payload)
-
onMessage
void onMessage(byte[] payload, boolean isBinary)
-
onPing
void onPing()
-
onPing
void onPing(byte[] payload)
-
onPong
void onPong()
-
onPong
void onPong(byte[] payload)
-
setConnection
void setConnection(WebSocketConnection connection)
-
-