Package com.iizix.nio
Interface WebSocketCommListener
- All Known Subinterfaces:
IServerWebSocketCommListener
- All Known Implementing Classes:
AbstractEndPoint
,LoadBalancerEndPoint
,RemoteBuilderEndPoint
,ServerSession
,VirtualizedMonitorEndPoint
public interface WebSocketCommListener
The WebSocket communication listener.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description static int
CC_ABNORMAL_CLOSURE
Abnormal Closure: iOS causes 1006 "Read EOF" if Safari is closed, or "Harsh disconnect" if just left alone for a long time.static int
CC_GOING_AWAY
Going Away: sent when e.g.static int
CC_INTERNAL_ERROR
Internal Error.static int
CC_INVALID_PAYLOAD_DATA
Invalid frame payload data.static int
CC_MANDATORY_EXT
Mandatory Ext.static int
CC_MESSAGE_TOO_BIG
Message Too Big.static int
CC_NO_STATUS_RECEIVED
No Status Received: send when e.g.static int
CC_NORMAL
Normal Closure.static int
CC_POLICY_VIOLATION
Policy Violation.static int
CC_PROTOCOL_ERROR
Protocol error.static int
CC_SERVICE_RESTART
Service Restart.static int
CC_TLS_HANDSHAKE
TLS handshakestatic int
CC_TRY_AGAIN_LATER
Try Again Later.static int
CC_UNSUPPORTED_DATA
Unsupported Data.
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onCommClosed(IWebSocketComm comm, int code, java.lang.String reason)
Called when the communication link is closed.void
onCommClosing(IWebSocketComm comm)
Called when the communication link is closing.void
onCommConnected(IWebSocketComm comm)
Called when the communication link is connected.void
onCommData(IWebSocketComm comm, byte[] data, int offset, int len)
Called when the communication link has received binary data.void
onCommData(IWebSocketComm comm, java.lang.String data)
Called when the communication link has received String data.void
onCommError(IWebSocketComm comm, java.lang.Throwable e)
Called when the communication link is closed.void
onCommHeartBeat(IWebSocketComm comm, long duration)
Called when a heart-beat frame is received.void
onCommOpen(IWebSocketComm comm)
Called when the communication link is opened.void
onCommTimeout(IWebSocketComm comm, boolean isReadTimeout)
Called when the communication link has timed out on a read or write operation.
Field Detail
CC_NORMAL
static final int CC_NORMAL
Normal Closure.- See Also:
- Constant Field Values
CC_GOING_AWAY
static final int CC_GOING_AWAY
Going Away: sent when e.g. IE closes a window.- See Also:
- Constant Field Values
CC_PROTOCOL_ERROR
static final int CC_PROTOCOL_ERROR
Protocol error.- See Also:
- Constant Field Values
CC_UNSUPPORTED_DATA
static final int CC_UNSUPPORTED_DATA
Unsupported Data.- See Also:
- Constant Field Values
CC_NO_STATUS_RECEIVED
static final int CC_NO_STATUS_RECEIVED
No Status Received: send when e.g. JS performs Close without code/reason.- See Also:
- Constant Field Values
CC_ABNORMAL_CLOSURE
static final int CC_ABNORMAL_CLOSURE
Abnormal Closure: iOS causes 1006 "Read EOF" if Safari is closed, or "Harsh disconnect" if just left alone for a long time.- See Also:
- Constant Field Values
CC_INVALID_PAYLOAD_DATA
static final int CC_INVALID_PAYLOAD_DATA
Invalid frame payload data.- See Also:
- Constant Field Values
CC_POLICY_VIOLATION
static final int CC_POLICY_VIOLATION
Policy Violation.- See Also:
- Constant Field Values
CC_MESSAGE_TOO_BIG
static final int CC_MESSAGE_TOO_BIG
Message Too Big.- See Also:
- Constant Field Values
CC_MANDATORY_EXT
static final int CC_MANDATORY_EXT
Mandatory Ext.- See Also:
- Constant Field Values
CC_INTERNAL_ERROR
static final int CC_INTERNAL_ERROR
Internal Error.- See Also:
- Constant Field Values
CC_SERVICE_RESTART
static final int CC_SERVICE_RESTART
Service Restart.- See Also:
- Constant Field Values
CC_TRY_AGAIN_LATER
static final int CC_TRY_AGAIN_LATER
Try Again Later.- See Also:
- Constant Field Values
CC_TLS_HANDSHAKE
static final int CC_TLS_HANDSHAKE
TLS handshake- See Also:
- Constant Field Values
Method Detail
onCommOpen
void onCommOpen(IWebSocketComm comm)
Called when the communication link is opened.- Parameters:
comm
- The WebSocket communication instance.
onCommConnected
void onCommConnected(IWebSocketComm comm)
Called when the communication link is connected.- Parameters:
comm
- The WebSocket communication instance.
onCommData
void onCommData(IWebSocketComm comm, byte[] data, int offset, int len)
Called when the communication link has received binary data.- Parameters:
comm
- The WebSocket communication instance.data
- The data byte array.offset
- Offset in buffer.len
- Length of data.
onCommData
void onCommData(IWebSocketComm comm, java.lang.String data)
Called when the communication link has received String data.- Parameters:
comm
- The WebSocket communication instance.data
- The String data.
onCommHeartBeat
void onCommHeartBeat(IWebSocketComm comm, long duration)
Called when a heart-beat frame is received.- Parameters:
comm
- The WebSocket communication instance.duration
- Duration of the PING-PONG message exchange in milliseconds.
onCommTimeout
void onCommTimeout(IWebSocketComm comm, boolean isReadTimeout)
Called when the communication link has timed out on a read or write operation.- Parameters:
comm
- The WebSocket communication instance.isReadTimeout
- Flag indicating read timeout when true, false indicates write timeout.
onCommError
void onCommError(IWebSocketComm comm, java.lang.Throwable e)
Called when the communication link is closed.- Parameters:
comm
- The WebSocket communication instance.e
- The exception.
onCommClosing
void onCommClosing(IWebSocketComm comm)
Called when the communication link is closing.- Parameters:
comm
- The WebSocket communication instance.
onCommClosed
void onCommClosed(IWebSocketComm comm, int code, java.lang.String reason)
Called when the communication link is closed.- Parameters:
comm
- The WebSocket communication instance.code
- The reason code for closure.reason
- The reason string explanation for closure.