public interface Endpoint
Modifier and Type | Method and Description |
---|---|
byte[] |
onBinaryMessage(WebSocket ws,
byte[] message)
A binary message has been received.
|
void |
onClose(WebSocket ws,
ReasonForClosure closeReason)
The associated
WebSocket is about to close. |
void |
onError(WebSocket ws,
Throwable thr)
An error occurred on the
WebSocket . |
void |
onOpen(WebSocket ws)
The connection has been established.
|
void |
onPing(byte[] data)
A ping frame has been received.
|
void |
onPong(byte[] data)
A pong frame has been received.
|
String |
onTextMessage(WebSocket ws,
String message)
A text message has been received.
|
byte[] onBinaryMessage(WebSocket ws, byte[] message)
If the return value is not null, then it is sent to the remote endpoint.
ws
- the WebSocket
on which the event occurredmessage
- the received messagevoid onClose(WebSocket ws, ReasonForClosure closeReason)
WebSocket
is about to close. This method is called if the remote endpoint started a closing handshake (that is, a
close control frame has been received and connection state was OPEN), or if the local application request to close the connection.
The underlying socket connection may already be closed to you should not try to send any further message in this callback.
ws
- the WebSocket
about to be closedcloseReason
- the reason for closingvoid onError(WebSocket ws, Throwable thr)
WebSocket
.ws
- the WebSocket
on which the event occurredthr
- the original errorvoid onOpen(WebSocket ws)
ws
- the WebSocket
on which the event occurredvoid onPing(byte[] data)
data
- the data received in the ping payloadvoid onPong(byte[] data)
data
- the data received in the pong payloadString onTextMessage(WebSocket ws, String message)
If the return value is not null, then it is sent to the remote endpoint.
ws
- the WebSocket
on which the event occurredmessage
- the received message