Package org.asynchttpclient.ws
Interface WebSocketListener
-
public interface WebSocketListenerA genericWebSocketListenerfor WebSocket events. Use the appropriate listener for receiving message bytes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidonBinaryFrame(byte[] payload, boolean finalFragment, int rsv)Invoked when a binary frame is received.voidonClose(WebSocket websocket, int code, String reason)Invoked when theWebSocketis closed.voidonError(Throwable t)Invoked when theWebSocketcrashes.voidonOpen(WebSocket websocket)Invoked when theWebSocketis open.default voidonPingFrame(byte[] payload)Invoked when a ping frame is receiveddefault voidonPongFrame(byte[] payload)Invoked when a pong frame is receiveddefault voidonTextFrame(String payload, boolean finalFragment, int rsv)Invoked when a text frame is received.
-
-
-
Method Detail
-
onOpen
void onOpen(WebSocket websocket)
Invoked when theWebSocketis open.- Parameters:
websocket- the WebSocket
-
onClose
void onClose(WebSocket websocket, int code, String reason)
Invoked when theWebSocketis closed.- Parameters:
websocket- the WebSocketcode- the status codereason- the reason message- See Also:
- "http://tools.ietf.org/html/rfc6455#section-5.5.1"
-
onBinaryFrame
default void onBinaryFrame(byte[] payload, boolean finalFragment, int rsv)Invoked when a binary frame is received.- Parameters:
payload- a byte arrayfinalFragment- true if this frame is the final fragmentrsv- extension bits
-
onTextFrame
default void onTextFrame(String payload, boolean finalFragment, int rsv)
Invoked when a text frame is received.- Parameters:
payload- a UTF-8StringmessagefinalFragment- true if this frame is the final fragmentrsv- extension bits
-
onPingFrame
default void onPingFrame(byte[] payload)
Invoked when a ping frame is received- Parameters:
payload- a byte array
-
onPongFrame
default void onPongFrame(byte[] payload)
Invoked when a pong frame is received- Parameters:
payload- a byte array
-
-