public interface WebSocket
| Modifier and Type | Interface and Description |
|---|---|
static class |
WebSocket.PayloadType
The format of a message payload.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(int code,
String reason)
Send a close frame to the server.
|
okio.BufferedSink |
newMessageSink(WebSocket.PayloadType type)
Stream a message payload to the server of the specified {code type}.
|
void |
sendMessage(WebSocket.PayloadType type,
okio.Buffer payload)
Send a message payload to the server of the specified
type. |
void |
sendPing(okio.Buffer payload)
Send a ping to the server with optional payload.
|
okio.BufferedSink newMessageSink(WebSocket.PayloadType type)
You must call close() to complete the message. Calls to
flush() write a frame fragment. The message may be empty.
IllegalStateException - if not connected, already closed, or another writer is active.void sendMessage(WebSocket.PayloadType type, okio.Buffer payload) throws IOException
type.IllegalStateException - if not connected, already closed, or another writer is active.IOExceptionvoid sendPing(okio.Buffer payload)
throws IOException
IllegalStateException - if already closed.IOExceptionvoid close(int code,
String reason)
throws IOException
The corresponding WebSocketListener will continue to get messages until its
onClose() method is called.
It is an error to call this method before calling close on an active writer. Calling this method more than once has no effect.
IllegalStateException - if already closed.IOExceptionCopyright © 2015. All Rights Reserved.