类 RealWebSocket
- 所有已实现的接口:
com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback,WebSocket
-
嵌套类概要
嵌套类从接口继承的嵌套类/接口 com.lark.oapi.okhttp.WebSocket
WebSocket.Factory -
构造器概要
构造器构造器说明RealWebSocket(Request request, WebSocketListener listener, Random random, long pingIntervalMillis) -
方法概要
修饰符和类型方法说明voidcancel()Immediately and violently release resources held by this web socket, discarding any enqueued messages.booleanAttempts to initiate a graceful shutdown of this web socket.voidconnect(OkHttpClient client) voidfailWebSocket(Exception e, Response response) voidinitReaderAndWriter(String name, RealWebSocket.Streams streams) voidReceive frames until there are no more.voidonReadClose(int code, String reason) voidonReadMessage(ByteString bytes) voidonReadMessage(String text) voidonReadPing(ByteString payload) voidonReadPong(ByteString buffer) longReturns the size in bytes of all messages enqueued to be transmitted to the server.request()Returns the original request that initiated this web socket.booleansend(ByteString bytes) Attempts to enqueuebytesto be sent as a the data of a binary (type0x2) message.booleanAttempts to enqueuetextto be UTF-8 encoded and sent as a the data of a text (type0x1) message.
-
构造器详细资料
-
RealWebSocket
public RealWebSocket(Request request, WebSocketListener listener, Random random, long pingIntervalMillis)
-
-
方法详细资料
-
request
从接口复制的说明:WebSocketReturns the original request that initiated this web socket. -
queueSize
public long queueSize()从接口复制的说明:WebSocketReturns 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. -
cancel
public void cancel()从接口复制的说明:WebSocketImmediately 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. -
connect
-
initReaderAndWriter
- 抛出:
IOException
-
loopReader
Receive frames until there are no more. Invoked only by the reader thread.- 抛出:
IOException
-
onReadMessage
- 指定者:
onReadMessage在接口中com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback- 抛出:
IOException
-
onReadMessage
- 指定者:
onReadMessage在接口中com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback- 抛出:
IOException
-
onReadPing
- 指定者:
onReadPing在接口中com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
-
onReadPong
- 指定者:
onReadPong在接口中com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
-
onReadClose
- 指定者:
onReadClose在接口中com.lark.oapi.okhttp.internal.ws.WebSocketReader.FrameCallback
-
send
从接口复制的说明:WebSocketAttempts to enqueuetextto be UTF-8 encoded and sent as a the data of a text (type0x1) 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
从接口复制的说明:WebSocketAttempts to enqueuebytesto be sent as a the data of a binary (type0x2) 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.
-
close
从接口复制的说明:WebSocketAttempts 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 toWebSocket.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 ornull.
-
failWebSocket
-