decodeWsFrame

fun <T> decodeWsFrame(text: String, deserializePayload: (String) -> T): EngineIOPacket<T>(source)

Decodes the given web socket text frame as a single EngineIOPacket.

If this packet is a EngineIOPacket.Message packet, the payload text is deserialized using the provided deserializePayload function.

This is meant to be used in web socket mode, where each web socket frame contains a single Engine.IO packet. When using HTTP long-polling with batched packets, use decodeHttpBatch instead.

Throws

if the given text is not a valid Engine.IO packet


fun <T> decodeWsFrame(bytes: ByteString, deserializePayload: (ByteString) -> T): EngineIOPacket.Message<T>(source)

Decodes the given binary web socket frame's bytes as a single EngineIOPacket.Message.

As specified by the protocol, binary messages are just sent as-is, so there is no real decoding involved in this function, it just wraps the bytes in a packet type for consistency.

This is meant to be used in web socket mode, where each web socket frame contains a single Engine.IO packet. When using HTTP long-polling with batched packets, use decodeHttpBatch instead.