Package ej.websocket
Interface Endpoint
-
- All Known Implementing Classes:
EndpointAdapter
public interface Endpoint
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]onBinaryMessage(WebSocket ws, byte[] message)A binary message has been received.voidonClose(WebSocket ws, ReasonForClosure closeReason)The associatedWebSocketis about to close.voidonError(WebSocket ws, Throwable thr)An error occurred on theWebSocket.voidonOpen(WebSocket ws)The connection has been established.voidonPing(byte[] data)A ping frame has been received.voidonPong(byte[] data)A pong frame has been received.StringonTextMessage(WebSocket ws, String message)A text message has been received.
-
-
-
Method Detail
-
onBinaryMessage
byte[] onBinaryMessage(WebSocket ws, byte[] message)
A binary message has been received.If the return value is not null, then it is sent to the remote endpoint.
- Parameters:
ws- theWebSocketon which the event occurredmessage- the received message- Returns:
- a return message that the WebSocket will send to the remote endpoint
-
onClose
void onClose(WebSocket ws, ReasonForClosure closeReason)
The associatedWebSocketis 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.
- Parameters:
ws- theWebSocketabout to be closedcloseReason- the reason for closing
-
onError
void onError(WebSocket ws, Throwable thr)
An error occurred on theWebSocket.- Parameters:
ws- theWebSocketon which the event occurredthr- the original error
-
onOpen
void onOpen(WebSocket ws)
The connection has been established.- Parameters:
ws- theWebSocketon which the event occurred
-
onPong
void onPong(byte[] data)
A pong frame has been received.- Parameters:
data- the data received in the pong payload
-
onPing
void onPing(byte[] data)
A ping frame has been received. The pong frame does not need to be sent manually, it will be done automatically by the websocket.- Parameters:
data- the data received in the ping payload
-
onTextMessage
String onTextMessage(WebSocket ws, String message)
A text message has been received.If the return value is not null, then it is sent to the remote endpoint.
- Parameters:
ws- theWebSocketon which the event occurredmessage- the received message- Returns:
- a return message that the WebSocket will send to the remote endpoint
-
-