Skip to content

Update rust sdk to use v3 websocket api#4765

Open
joshua-spacetime wants to merge 1 commit intojoshua/ws/v3from
joshua/rust/v3-ws-bindings
Open

Update rust sdk to use v3 websocket api#4765
joshua-spacetime wants to merge 1 commit intojoshua/ws/v3from
joshua/rust/v3-ws-bindings

Conversation

@joshua-spacetime
Copy link
Copy Markdown
Collaborator

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 v3 first and falls back to v2
  • when v3 is negotiated, outbound client messages are batched into a single websocket frame up to 256 KiB
  • inbound v3 server frames are unwrapped back into ordered v2 ServerMessages
  • v2 behavior 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant