Expand description
Shared WebSocket frame decoding helpers.
Every exchange’s WS handler needs to (a) handle both single-object and
array-of-objects frames, (b) skip the slow serde_json::Value +
from_value(value.clone()) double-parse pattern that existed before.
decode_frame centralises both.
When the simd-json feature is enabled, large payloads route through
simd-json’s SIMD tokenizer (~15-20% faster on mid-to-large WS frames);
small payloads stay on serde_json, where the SIMD startup cost would
otherwise dominate the parse.
Enums§
- WsFrame
- A parsed WebSocket frame — either a single object or an array-of-objects.
Functions§
- decode_
frame - Decode
textinto aWsFrame<T>with a single pass of whatever JSON parser is fastest for its size. - decode_
value - Parse
textinto aserde_json::Valueusing the same size-based simd switching asdecode_frame. For exchanges (e.g. kalshi) that dispatch on a field inside a loosely typed Value rather than deserialising into a bespokeRawWsMessagestruct.