public interface WebSocketListener
|Modifier and Type||Method and Description|
A WebSocket binary frame has been received.
A Close Event was received.
A WebSocket exception has occurred.
A WebSocket Text frame was received.
void onWebSocketBinary(byte payload, int offset, int len)
payload- the raw payload array received
offset- the offset in the payload array where the data starts
len- the length of bytes in the payload
void onWebSocketClose(int statusCode, String reason)
The underlying Connection will be considered closed at this point.
statusCode- the close status code. (See
reason- the optional reason for the close.
void onWebSocketConnect(Session session)
Sessionhas connected successfully and is ready to be used.
Note: It is a good idea to track this session as a field in your object so that you can write messages back via the
session- the websocket session.
void onWebSocketError(Throwable cause)
This is a way for the internal implementation to notify of exceptions occured during the processing of websocket.
Usually this occurs from bad / malformed incoming packets. (example: bad UTF8 data, frames that are too big, violations of the spec)
This will result in the
Session being closed by the implementing side.
error- the error that occurred.
void onWebSocketText(String message)
Copyright © 1995-2014 Mort Bay Consulting. All Rights Reserved.