WebSocketListener

abstract class WebSocketListener

WebSocket 监听器

参见:okhttp3.WebSocketListener

Author

Jenly

Follow me

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun onClosed(webSocket: IWebSocket, code: Int, reason: String)

Invoked when both peers have indicated that no more messages will be transmitted and the connection has been successfully released. No further calls to this listener will be made.

Link copied to clipboard
open fun onClosing(webSocket: IWebSocket, code: Int, reason: String)

Invoked when the remote peer has indicated that no more incoming messages will be transmitted.

Link copied to clipboard
open fun onFailure(webSocket: IWebSocket, t: Throwable, response: Response?)

Invoked when a web socket has been closed due to an error reading from or writing to the network. Both outgoing and incoming messages may have been lost. No further calls to this listener will be made.

Link copied to clipboard
open fun onMessage(webSocket: IWebSocket, text: String)

Invoked when a text (type 0x1) message has been received.

open fun onMessage(webSocket: IWebSocket, bytes: ByteString)

Invoked when a binary (type 0x2) message has been received.

Link copied to clipboard
open fun onOpen(webSocket: IWebSocket, response: Response)

Invoked when a web socket has been accepted by the remote peer and may begin transmitting messages.