public interface WebSocketListener
WebSocketListener
for WebSocket events. Use the appropriate listener for receiving message bytes.Modifier and Type | Method and Description |
---|---|
default void |
onBinaryFrame(byte[] payload,
boolean finalFragment,
int rsv)
Invoked when a binary frame is received.
|
void |
onClose(WebSocket websocket,
int code,
java.lang.String reason)
Invoked when the
WebSocket is closed. |
void |
onError(java.lang.Throwable t)
Invoked when the
WebSocket crashes. |
void |
onOpen(WebSocket websocket)
Invoked when the
WebSocket is open. |
default void |
onPingFrame(byte[] payload)
Invoked when a ping frame is received
|
default void |
onPongFrame(byte[] payload)
Invoked when a pong frame is received
|
default void |
onTextFrame(java.lang.String payload,
boolean finalFragment,
int rsv)
Invoked when a text frame is received.
|
void onOpen(WebSocket websocket)
WebSocket
is open.websocket
- the WebSocketvoid onClose(WebSocket websocket, int code, java.lang.String reason)
WebSocket
is closed.websocket
- the WebSocketcode
- the status codereason
- the reason messagevoid onError(java.lang.Throwable t)
WebSocket
crashes.t
- a Throwable
default void onBinaryFrame(byte[] payload, boolean finalFragment, int rsv)
payload
- a byte arrayfinalFragment
- true if this frame is the final fragmentrsv
- extension bitsdefault void onTextFrame(java.lang.String payload, boolean finalFragment, int rsv)
payload
- a UTF-8 String
messagefinalFragment
- true if this frame is the final fragmentrsv
- extension bitsdefault void onPingFrame(byte[] payload)
payload
- a byte arraydefault void onPongFrame(byte[] payload)
payload
- a byte arrayCopyright © 2018. All Rights Reserved.