DefaultWebSocketServerSession

Represents a server-side web socket session with all default implementations

See also

Functions

Link copied to clipboard
abstract suspend fun flush()
Link copied to clipboard
open suspend fun send(frame: Frame)
Link copied to clipboard
abstract fun start(negotiatedExtensions: List<WebSocketExtension<*>>)
Link copied to clipboard
abstract fun terminate()

Properties

Link copied to clipboard
abstract val call: ApplicationCall

Associated received call that originating this session

Link copied to clipboard
abstract val closeReason: Deferred<CloseReason?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val incoming: ReceiveChannel<Frame>
Link copied to clipboard
abstract var masking: Boolean
Link copied to clipboard
abstract var maxFrameSize: Long
Link copied to clipboard
abstract val outgoing: SendChannel<Frame>
Link copied to clipboard
abstract var pingIntervalMillis: Long
Link copied to clipboard
abstract var timeoutMillis: Long

Extensions

Link copied to clipboard

An application that started this web socket session

Link copied to clipboard

Converter for web socket session

Link copied to clipboard

Ping interval or null to disable pinger. Please note that pongs will be handled despite this setting.

Link copied to clipboard

Dequeues a frame and deserializes it to the type T using WebSocket content converter. May throw an exception WebsocketDeserializeException if the converter can't deserialize frame data to type T. May throw WebsocketDeserializeException if the received frame type is not Frame.Text or Frame.Binary. In this case, WebsocketDeserializeException.frame contains the received frame. May throw ClosedReceiveChannelException if a channel was closed

Link copied to clipboard
inline suspend fun <T> WebSocketServerSession.sendSerialized(data: T)

Serializes data to a frame and enqueues this frame. May suspend if the outgoing queue is full. If the outgoing channel is already closed, throws an exception, so it is impossible to transfer any message. Frames sent after a Close frame are silently ignored. Note that a Close frame could be sent automatically in reply to a peer's Close frame unless it is a raw WebSocket session.

Link copied to clipboard

A timeout to wait for pong reply to ping otherwise the session will be terminated immediately. It doesn't have any effect if pingInterval is null (pinger is disabled).