Constructor and Description |
---|
EndpointAdapter() |
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.
|
public byte[] onBinaryMessage(WebSocket ws, byte[] message)
Endpoint
If the return value is not null, then it is sent to the remote endpoint.
onBinaryMessage
in interface Endpoint
ws
- the WebSocket
on which the event occurredmessage
- the received messagepublic void onClose(WebSocket ws, ReasonForClosure closeReason)
Endpoint
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.
public void onError(WebSocket ws, Throwable thr)
Endpoint
WebSocket
.public void onOpen(WebSocket ws)
Endpoint
public void onPing(byte[] data)
Endpoint
public void onPong(byte[] data)
Endpoint
public String onTextMessage(WebSocket ws, String message)
Endpoint
If the return value is not null, then it is sent to the remote endpoint.
onTextMessage
in interface Endpoint
ws
- the WebSocket
on which the event occurredmessage
- the received message