-
- 所有超级接口:
Cancelable
public interface WebSocket extends Cancelable
-
-
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static classWebSocket.Closestatic interfaceWebSocket.Listener<T>static interfaceWebSocket.MessageWebSocket 消息
-
字段概要
字段 修饰符和类型 字段 说明 static intSTATUS_CANCELEDstatic intSTATUS_CONNECTEDstatic intSTATUS_CONNECTINGstatic intSTATUS_DISCONNECTEDstatic intSTATUS_EXCEPTIONstatic intSTATUS_NETWORK_ERRORstatic intSTATUS_TIMEOUT
-
-
-
字段详细资料
-
STATUS_CANCELED
static final int STATUS_CANCELED
- 另请参阅:
- 常量字段值
-
STATUS_CONNECTING
static final int STATUS_CONNECTING
- 另请参阅:
- 常量字段值
-
STATUS_CONNECTED
static final int STATUS_CONNECTED
- 另请参阅:
- 常量字段值
-
STATUS_DISCONNECTED
static final int STATUS_DISCONNECTED
- 另请参阅:
- 常量字段值
-
STATUS_NETWORK_ERROR
static final int STATUS_NETWORK_ERROR
- 另请参阅:
- 常量字段值
-
STATUS_TIMEOUT
static final int STATUS_TIMEOUT
- 另请参阅:
- 常量字段值
-
STATUS_EXCEPTION
static final int STATUS_EXCEPTION
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
queueSize
long queueSize()
- 返回:
- 若连接已打开,则:
同
WebSocket.queueSize(),返回排序消息的字节数 否则: 返回排队消息的数量
-
send
boolean send(Object object)
- 参数:
object- 待发送的对象,可以是 String | ByteString | byte[] | Java Bean- 返回:
- 如果连接已断开 返回 false
-
close
void 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 ornull.
-
msgType
void msgType(String type)
设置消息类型- 参数:
type- 消息类型,如 json、xml、protobuf 等
-
status
int status()
WebSocket 当前的连接状态- 返回:
- 连接状态标识
- 从以下版本开始:
- v2.4.5
- 另请参阅:
STATUS_CANCELED,STATUS_CONNECTING,STATUS_CONNECTED,STATUS_DISCONNECTED,STATUS_NETWORK_ERROR,STATUS_TIMEOUT,STATUS_EXCEPTION
-
-