public interface WebSocketClientListenerInterface
WebSocketClient
Modifier and Type | Method and Description |
---|---|
default void |
onBinary(WebSocketClientContext clientContext,
byte[] data,
long receiveTimeMillis)
Optional: Called when the last frame of a stream of binary-frames is received.
|
void |
onClose(WebSocketClientContext clientContext)
Called when the WebSocket connection is closed by the server.
|
default void |
onError(WebSocketClientContext clientContext,
java.lang.Throwable error,
Frame frame)
Optional: Called when an communication error or an internal error has occurred.
|
default void |
onFrame(WebSocketClientContext clientContext,
Frame frame,
long receiveTimeMillis)
Optional: Called for every single received frame - regardless if the fin bit is set or not.
|
default void |
onOpen(WebSocketClientContext clientContext)
Optional: Called when WebSocket connection is established to the server.
|
default void |
onPing(WebSocketClientContext clientContext,
byte[] data,
long receiveTimeMillis)
Optional: Called when a ping is received from the server.
|
default void |
onPong(WebSocketClientContext clientContext,
byte[] data,
long receiveTimeMillis)
Optional: Called when a pong is received from the server.
|
void |
onText(WebSocketClientContext clientContext,
java.lang.String text,
long receiveTimeMillis)
Called when the last frame of a stream of text-frames is received.
|
default void onOpen(WebSocketClientContext clientContext) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientjava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methoddefault void onFrame(WebSocketClientContext clientContext, Frame frame, long receiveTimeMillis) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientframe
- the received framereceiveTimeMillis
- the time in milliseconds elapsed from receiving the first byte of the frame until the last byte of the framejava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methodvoid onText(WebSocketClientContext clientContext, java.lang.String text, long receiveTimeMillis) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clienttext
- the received text, combined overall received text-frame fragments.receiveTimeMillis
- the time in milliseconds elapsed from receiving the first byte of the first frame until receiving the last byte of the last framejava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methoddefault void onBinary(WebSocketClientContext clientContext, byte[] data, long receiveTimeMillis) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientdata
- the received data, combined overall received binary-frame fragmentsreceiveTimeMillis
- the time in milliseconds elapsed from receiving the first byte of the first frame until receiving the last byte of the last framejava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methoddefault void onPing(WebSocketClientContext clientContext, byte[] data, long receiveTimeMillis) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientdata
- the payload of the pingreceiveTimeMillis
- the time in milliseconds for receiving the pingjava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methoddefault void onPong(WebSocketClientContext clientContext, byte[] data, long receiveTimeMillis) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientdata
- the payload of the pongreceiveTimeMillis
- the time in milliseconds for receiving the pongjava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methodvoid onClose(WebSocketClientContext clientContext) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clientjava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this methoddefault void onError(WebSocketClientContext clientContext, java.lang.Throwable error, Frame frame) throws java.io.IOException, java.lang.InterruptedException, WebSocketClientListenerException
clientContext
- The context of the WebSocket clienterror
- the occurred errorframe
- the frame for which the error occurred, or null if no such information is availablejava.io.IOException
- if an I/O error did occurjava.lang.InterruptedException
- if the current thread was interruptedWebSocketClientListenerException
- if somewhat went wrong in the implementation of this method