sendSerialized

suspend fun WebSocketServerSession.sendSerialized(data: Any?, typeInfo: TypeInfo)

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.

Parameters

typeInfo

Type info of T. Can be retrieved with typeInfo function.

Throws

if no contentConverter is found for the WebSockets plugin


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.

Throws

if no contentConverter is found for the WebSockets plugin