Update rust sdk to use v3 websocket api by joshua-spacetime · Pull Request #4765 · clockworklabs/SpacetimeDB
Description of Changes
Adds Rust SDK support for the v3.bsatn.spacetimedb WebSocket API which was added in #4761.
v3 is treated as a transport wrapper around existing v2 logical messages. On the Rust SDK side, that means:
- the native client offers
v3first and falls back tov2 - when
v3is negotiated, outbound client messages are batched into a single websocket frame up to256 KiB - inbound
v3server frames are unwrapped back into ordered v2ServerMessages v2behavior remains unchanged
The browser SDK path stays on v2 for now because the current wasm websocket wrapper does not expose the negotiated subprotocol, so safe v3/v2 fallback would require replacing that wrapper.
API and ABI breaking changes
None. The Rust SDK public API is unchanged. Existing v2 servers continue to work via fallback, and the browser path remains on v2.
Expected complexity level and risk
3
The surface area is small, but this changes transport negotiation, websocket framing, batching behavior, and inbound/outbound message handling in the native Rust SDK. The main risk is preserving correct v2 fallback and ordered handling while introducing capped v3 batching.
Testing
- Negotiated protocol handling
- Outbound v3 batching and frame capping
- Inbound v3 batch decoding