UnboundedWsListenerFlowAdapter

An adapter similar to WebSocketListenerFlowAdapter, but with an unlimited buffer and non-suspending callback functions. This is useful for bridging implementations that do not support backpressure (like the browser WebSocket API).

This implementation does not support partial messages.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

The flow of incoming web socket frames. The underlying channel is closed when the web socket connection is closed

Functions

Link copied to clipboard
fun onBinaryMessage(bytes: ByteString): ChannelResult<Unit>

Sends a WebSocketFrame.Binary frame to the incomingFrames flow.

Link copied to clipboard
fun onClose(code: Int, reason: String?): ChannelResult<Unit>

Sends a WebSocketFrame.Close to the incomingFrames flow, and completes it normally.

Link copied to clipboard
fun onError(message: String)

Fails the incomingFrames flow with a WebSocketException with the given message.

fun onError(error: Throwable?)

Fails the incomingFrames flow with a WebSocketException with the given error as cause.

Link copied to clipboard
fun onPing(bytes: ByteString): ChannelResult<Unit>

Sends a WebSocketFrame.Ping frame to the incomingFrames flow.

Link copied to clipboard
fun onPong(bytes: ByteString): ChannelResult<Unit>

Sends a WebSocketFrame.Pong frame to the incomingFrames flow.

Link copied to clipboard