decodeHttpBatch

fun <T> decodeHttpBatch(batch: String, deserializePayload: (String) -> T): List<EngineIOPacket<T>>(source)

Decodes the given batch text as a batch of EngineIOPackets.

Individual packets in batch must be delimited by the "record separator" (U+001E) character, as defined in the specification.

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

This is meant to be used in HTTP long-polling mode, where packets are batched in a single HTTP response. When using web sockets, use decodeWsFrame on each frame instead.

Throws

if the given batch contains an invalid Engine.IO packet