Update typescript sdk to use v3 websocket api#4762
Open
joshua-spacetime wants to merge 2 commits intojoshua/ws/v3from
Open
Update typescript sdk to use v3 websocket api#4762joshua-spacetime wants to merge 2 commits intojoshua/ws/v3from
joshua-spacetime wants to merge 2 commits intojoshua/ws/v3from
Conversation
coolreader18
approved these changes
Apr 10, 2026
Collaborator
coolreader18
left a comment
There was a problem hiding this comment.
LGTM
I know this isn't the topic of changes in this PR, but is there a point to having distinct Single / Batch frames? How is a Single frame different from a Batch of 1? And then you have redundant data in the binary payload: 0x01 /* <- this frame has more than 1 message */ 0x00_00_00_01 /* <- now here's how many messages this frame has */. The data in the enum tag is already communicated in the array length.
Comment on lines
+6
to
+7
| type ClientFrame as ClientFrameValue, | ||
| type ServerFrame as ServerFrameValue, |
Collaborator
There was a problem hiding this comment.
This seems unnecessary. You can just use ClientFrame / ServerFrame as types, you don't even need these type imports.
Collaborator
Author
It's not. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Adds TypeScript SDK support for the
v3.bsatn.spacetimedbwebsocket API which was added in #4761.v3just adds batching on top ofv2, so adding support for it just required the following:v2if necessaryv3is negotiated, same-tick outbound client messages are batched into a single ws framev3server frames are unwrapped into their inner v2 messages and processed in-orderSome notes on the batching behavior:
v3frames are capped at256 KiB(unless a single message exceeds the limit)API and ABI breaking changes
None,
v2fallback remains supported, so existing servers that only negotiatev2still work with the updated client.Expected complexity level and risk
3
Constraints that must hold:
v3v2should remain unaffectedv2must remain correctTesting
Added tests for the fast path and fallback behavior