类 RealWebSocket

java.lang.Object
com.lark.oapi.okhttp.internal.ws.RealWebSocket
所有已实现的接口:
com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback, WebSocket

public final class RealWebSocket extends Object implements WebSocket, com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
  • 构造器详细资料

  • 方法详细资料

    • request

      public Request request()
      从接口复制的说明: WebSocket
      Returns the original request that initiated this web socket.
      指定者:
      request 在接口中 WebSocket
    • queueSize

      public long queueSize()
      从接口复制的说明: WebSocket
      Returns the size in bytes of all messages enqueued to be transmitted to the server. This doesn't include framing overhead. It also doesn't include any bytes buffered by the operating system or network intermediaries. This method returns 0 if no messages are waiting in the queue. If may return a nonzero value after the web socket has been canceled; this indicates that enqueued messages were not transmitted.
      指定者:
      queueSize 在接口中 WebSocket
    • cancel

      public void cancel()
      从接口复制的说明: WebSocket
      Immediately and violently release resources held by this web socket, discarding any enqueued messages. This does nothing if the web socket has already been closed or canceled.
      指定者:
      cancel 在接口中 WebSocket
    • connect

      public void connect(OkHttpClient client)
    • initReaderAndWriter

      public void initReaderAndWriter(String name, RealWebSocket.Streams streams) throws IOException
      抛出:
      IOException
    • loopReader

      public void loopReader() throws IOException
      Receive frames until there are no more. Invoked only by the reader thread.
      抛出:
      IOException
    • onReadMessage

      public void onReadMessage(String text) throws IOException
      指定者:
      onReadMessage 在接口中 com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
      抛出:
      IOException
    • onReadMessage

      public void onReadMessage(ByteString bytes) throws IOException
      指定者:
      onReadMessage 在接口中 com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
      抛出:
      IOException
    • onReadPing

      public void onReadPing(ByteString payload)
      指定者:
      onReadPing 在接口中 com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
    • onReadPong

      public void onReadPong(ByteString buffer)
      指定者:
      onReadPong 在接口中 com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
    • onReadClose

      public void onReadClose(int code, String reason)
      指定者:
      onReadClose 在接口中 com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
    • send

      public boolean send(String text)
      从接口复制的说明: WebSocket
      Attempts to enqueue text to be UTF-8 encoded and sent as a the data of a text (type 0x1) message.

      This method returns true if the message was enqueued. Messages that would overflow the outgoing message buffer will be rejected and trigger a graceful shutdown of this web socket. This method returns false in that case, and in any other case where this web socket is closing, closed, or canceled.

      This method returns immediately.

      指定者:
      send 在接口中 WebSocket
    • send

      public boolean send(ByteString bytes)
      从接口复制的说明: WebSocket
      Attempts to enqueue bytes to be sent as a the data of a binary (type 0x2) message.

      This method returns true if the message was enqueued. Messages that would overflow the outgoing message buffer (16 MiB) will be rejected and trigger a graceful shutdown of this web socket. This method returns false in that case, and in any other case where this web socket is closing, closed, or canceled.

      This method returns immediately.

      指定者:
      send 在接口中 WebSocket
    • close

      public boolean close(int code, String reason)
      从接口复制的说明: WebSocket
      Attempts to initiate a graceful shutdown of this web socket. Any already-enqueued messages will be transmitted before the close message is sent but subsequent calls to WebSocket.send(java.lang.String) will return false and their messages will not be enqueued.

      This returns true if a graceful shutdown was initiated by this call. It returns false if a graceful shutdown was already underway or if the web socket is already closed or canceled.

      指定者:
      close 在接口中 WebSocket
      参数:
      code - Status code as defined by Section 7.4 of RFC 6455.
      reason - Reason for shutting down or null.
    • failWebSocket

      public void failWebSocket(Exception e, @Nullable Response response)