Package ej.websocket.util
Class EndpointAdapter
- java.lang.Object
-
- ej.websocket.util.EndpointAdapter
-
-
Constructor Summary
Constructors Constructor Description EndpointAdapter()
-
Method Summary
All Methods Instance Methods Concrete 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
public byte[] onBinaryMessage(WebSocket ws, byte[] message)
Description copied from interface:EndpointA binary message has been received.If the return value is not null, then it is sent to the remote endpoint.
- Specified by:
onBinaryMessagein interfaceEndpoint- Parameters:
ws- theWebSocketon which the event occurredmessage- the received message- Returns:
- a return message that the WebSocket will send to the remote endpoint
-
onClose
public void onClose(WebSocket ws, ReasonForClosure closeReason)
Description copied from interface:EndpointThe 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.
-
onError
public void onError(WebSocket ws, Throwable thr)
Description copied from interface:EndpointAn error occurred on theWebSocket.
-
onOpen
public void onOpen(WebSocket ws)
Description copied from interface:EndpointThe connection has been established.
-
onPong
public void onPong(byte[] data)
Description copied from interface:EndpointA pong frame has been received.
-
onPing
public void onPing(byte[] data)
Description copied from interface:EndpointA ping frame has been received. The pong frame does not need to be sent manually, it will be done automatically by the websocket.
-
onTextMessage
public String onTextMessage(WebSocket ws, String message)
Description copied from interface:EndpointA text message has been received.If the return value is not null, then it is sent to the remote endpoint.
- Specified by:
onTextMessagein interfaceEndpoint- Parameters:
ws- theWebSocketon which the event occurredmessage- the received message- Returns:
- a return message that the WebSocket will send to the remote endpoint
-
-