WebsocketContentConverter

interface WebsocketContentConverter

A custom content converter that could be used in the WebSockets plugin Could provide bi-directional conversion implementation. One of the most typical examples of the content converter is a JSON converter that provides both serialization and deserialization

Functions

Link copied to clipboard
abstract suspend fun deserialize(charset: Charset, typeInfo: TypeInfo, content: Frame): Any

Deserializes content to the value of type typeInfo

Link copied to clipboard
abstract fun isApplicable(frame: Frame): Boolean

Checks if the content converter can deserialize a frame

Link copied to clipboard
abstract suspend fun serialize(charset: Charset, typeInfo: TypeInfo, value: Any): Frame

Serializes a value to a WebSocket Frame. This function could throw WebsocketConverterNotFoundException if the value is not suitable for conversion