public interface WebSocket extends Cancelable
| 限定符和类型 | 接口和说明 |
|---|---|
static class |
WebSocket.Close |
static interface |
WebSocket.Listener<T> |
static interface |
WebSocket.Message
WebSocket 消息
|
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
STATUS_CANCELED |
static int |
STATUS_CONNECTED |
static int |
STATUS_CONNECTING |
static int |
STATUS_DISCONNECTED |
static int |
STATUS_EXCEPTION |
static int |
STATUS_NETWORK_ERROR |
static int |
STATUS_TIMEOUT |
static final int STATUS_CANCELED
static final int STATUS_CONNECTING
static final int STATUS_CONNECTED
static final int STATUS_DISCONNECTED
static final int STATUS_NETWORK_ERROR
static final int STATUS_TIMEOUT
static final int STATUS_EXCEPTION
long queueSize()
WebSocket.queueSize(),返回排序消息的字节数
否则:
返回排队消息的数量boolean send(Object object)
object - 待发送的对象,可以是 String | ByteString | byte[] | Java Beanvoid close(int code,
String reason)
WebSocket.close(int, String)code - Status code as defined by Section 7.4 of RFC 6455reason - Reason for shutting down or null.void msgType(String type)
type - 消息类型,如 json、xml、protobuf 等int status()
STATUS_CANCELED,
STATUS_CONNECTING,
STATUS_CONNECTED,
STATUS_DISCONNECTED,
STATUS_NETWORK_ERROR,
STATUS_TIMEOUT,
STATUS_EXCEPTIONCopyright © 2025 zhouxu. All rights reserved.