Package io.ktor.websocket.serialization
Functions
Link copied to clipboard
inline suspend fun <T : Any> WebSocketSession.receiveDeserializedBase(converter: WebsocketContentConverter, charset: Charset): T
Content copied to clipboard
Dequeues a frame and deserializes it to the type T using converter. 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 : Any> WebSocketSession.sendSerializedBase(data: T, converter: WebsocketContentConverter, charset: Charset)
Content copied to clipboard
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.