sendSerializedBase

inline suspend fun <T> WebSocketSession.sendSerializedBase(data: Any?, converter: WebsocketContentConverter, charset: Charset)

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

data

The data to serialize

converter

The WebSocket converter

charset

Response charset


suspend fun WebSocketSession.sendSerializedBase(data: Any?, typeInfo: TypeInfo, converter: WebsocketContentConverter, charset: Charset)

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

data

The data to serialize

typeInfo

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

converter

The WebSocket converter

charset

Response charset