public interface WebSocketListener
WebSocket.| Modifier and Type | Method and Description |
|---|---|
void |
onClose(int code,
String reason)
Called when the server sends a close message.
|
void |
onFailure(IOException e)
Called when the transport or protocol layer of this web socket errors during communication.
|
void |
onMessage(okio.BufferedSource payload,
WebSocket.PayloadType type)
Called when a server message is received.
|
void |
onOpen(WebSocket webSocket,
Request request,
Response response) |
void |
onPong(okio.Buffer payload)
Called when a server pong is received.
|
void onOpen(WebSocket webSocket, Request request, Response response) throws IOException
IOExceptionvoid onMessage(okio.BufferedSource payload,
WebSocket.PayloadType type)
throws IOException
type indicates whether the
payload should be interpreted as UTF-8 text or binary data.
Implementations must call source.close() before returning. This
indicates completion of parsing the message payload and will consume any remaining bytes in
the message.
IOExceptionvoid onPong(okio.Buffer payload)
WebSocket.sendPing(Buffer) but might also be unsolicited.void onClose(int code,
String reason)
close() or as an unprompted
message from the server.code - The RFC-compliant
status code.reason - Reason for close or an empty string.void onFailure(IOException e)
Copyright © 2015. All Rights Reserved.