public interface SimpleEndpoint
| Modifier and Type | Method and Description |
|---|---|
void |
onClose(SimpleSession session,
int closeReasonCode,
java.lang.String closeReasonPhrase)
Invoked when a remote peer closed the WebSocket session or if
SimpleSession.close(int, java.lang.String)
is invoked on our side. |
void |
onError(SimpleSession session,
java.lang.Throwable t)
Invoked when errors occur out of the normal band of the WebSocket protocol.
|
void |
onMessage(SimpleSession session,
byte[] message,
int messageLen)
Invoked when a binary message is received from the peer.
|
void |
onMessage(SimpleSession session,
java.lang.String message)
Invoked when a text-based message is received from the peer.
|
void |
onOpen(SimpleSession session)
Invoked when a new WebSocket session is established.
|
void onOpen(SimpleSession session)
session - Unique handle for this session.void onMessage(SimpleSession session, java.lang.String message)
session - Unique handle for this session.message - Complete payload data.void onMessage(SimpleSession session, byte[] message, int messageLen)
session - Unique handle for this session.message - Complete payload data.messageLen - Maximum number of bytes of message to read.void onClose(SimpleSession session, int closeReasonCode, java.lang.String closeReasonPhrase)
SimpleSession.close(int, java.lang.String)
is invoked on our side.session - Unique handle for this session.closeReasonCode - Close reason code (see RFC6455)closeReasonPhrase - Possibly arbitrary text phrase associated with the reason code.void onError(SimpleSession session, java.lang.Throwable t)
onClose(com.facebook.stetho.websocket.SimpleSession, int, java.lang.String) method
will still be invoked in all cases, making it reasonable to simply log in this method.session - Unique handle for this session.t - Exception that occurred.