模块 okhttps

接口 WebSocket

所有超级接口:
Cancelable

public interface WebSocket extends Cancelable
  • 字段详细资料

    • 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 6455
      reason - Reason for shutting down or null.
    • msgType

      void msgType(String type)
      设置消息类型
      参数:
      type - 消息类型,如 json、xml、protobuf 等
    • status

      int status()
      WebSocket 当前的连接状态
      返回:
      连接状态标识
      从以下版本开始:
      v2.4.5
      另请参阅: