WebSocketWriter

class WebSocketWriter(writeChannel: ByteWriteChannel, val coroutineContext: CoroutineContext, var masking: Boolean = false, val pool: ObjectPool<ByteBuffer> = KtorDefaultPool, queueConfig: ChannelConfig = ChannelConfig.UNLIMITED) : CoroutineScope(source)

Class that processes written outgoing Websocket Frame, serializes them, and writes the bits into the writeChannel.

Report a problem

Parameters

queueConfig

: configuration for the internal Frame queue.

Constructors

Link copied to clipboard
constructor(writeChannel: ByteWriteChannel, coroutineContext: CoroutineContext, masking: Boolean = false, pool: ObjectPool<ByteBuffer> = KtorDefaultPool, queueConfig: ChannelConfig = ChannelConfig.UNLIMITED)

Properties

Link copied to clipboard
Link copied to clipboard

: whether it will mask serialized frames.

Link copied to clipboard

Channel for sending Websocket's Frame that will be serialized and written to writeChannel.

Link copied to clipboard

: ByteBuffer pool to be used by this writer

Functions

Link copied to clipboard
suspend fun flush()

Ensures all enqueued messages have been written

Link copied to clipboard
suspend fun send(frame: Frame)

Send a frame and write it and all outstanding frames in the queue