Interface WebSocket.Listener
-
- Enclosing interface:
- WebSocket
public static interface WebSocket.ListenerCallback methods for websocket events. The methods are guaranteed to be called serially - except foronError(WebSocket, Throwable)
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidonClose(WebSocket webSocket, int code, String reason)Called when the remote input closes.default voidonError(WebSocket webSocket, Throwable error)Called when an error has occurred.default voidonMessage(WebSocket webSocket, String text)Called once the full text message has been built.default voidonMessage(WebSocket webSocket, ByteBuffer bytes)Called once the full binary message has been built.default voidonOpen(WebSocket webSocket)
-
-
-
Method Detail
-
onOpen
default void onOpen(WebSocket webSocket)
-
onMessage
default void onMessage(WebSocket webSocket, String text)
Called once the full text message has been built.WebSocket.request()must be called to receive more messages.
-
onMessage
default void onMessage(WebSocket webSocket, ByteBuffer bytes)
Called once the full binary message has been built.WebSocket.request()must be called to receive more messages.
-
onClose
default void onClose(WebSocket webSocket, int code, String reason)
Called when the remote input closes. It's a terminal event, calls toWebSocket.request()do nothing after this. SomeHttpClientimplementations will requireWebSocket.request()to be called to calling onClose.
-
onError
default void onError(WebSocket webSocket, Throwable error)
Called when an error has occurred. It's a terminal event, calls toWebSocket.request()do nothing after this.protocol errors should be instances of
ProtocolException
other connection errors should be instances ofIOException
-
-