Skip to content

Batch websocket responses using the v3 protocol#5061

Open
joshua-spacetime wants to merge 2 commits into
masterfrom
joshua/batch-server-side-sends
Open

Batch websocket responses using the v3 protocol#5061
joshua-spacetime wants to merge 2 commits into
masterfrom
joshua/batch-server-side-sends

Conversation

@joshua-spacetime
Copy link
Copy Markdown
Contributor

@joshua-spacetime joshua-spacetime commented May 17, 2026

Description of Changes

In keeping with the "pipeline everything" approach of SpacetimeDB, this patch serializes multiple client updates in a single websocket message using the v3 protocol.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

My preference would be to teach spacetime subscribe to talk v2/v3 in order to get adequate coverage via the smoketests.

@joshua-spacetime joshua-spacetime force-pushed the joshua/message-pipelining branch from c5c3d1a to 0972b81 Compare May 18, 2026 04:30
@joshua-spacetime joshua-spacetime force-pushed the joshua/batch-server-side-sends branch from 31e54ca to fa60dfa Compare May 18, 2026 04:32
@joshua-spacetime joshua-spacetime force-pushed the joshua/message-pipelining branch from 0972b81 to 2926736 Compare May 18, 2026 18:23
@joshua-spacetime joshua-spacetime force-pushed the joshua/batch-server-side-sends branch from fa60dfa to 7f11e8b Compare May 18, 2026 18:24
Base automatically changed from joshua/message-pipelining to master May 18, 2026 22:46
@joshua-spacetime joshua-spacetime force-pushed the joshua/batch-server-side-sends branch 2 times, most recently from d6cc30a to abcec19 Compare May 19, 2026 00:54
@joshua-spacetime joshua-spacetime marked this pull request as ready for review May 19, 2026 00:56
Comment on lines -207 to +208
#[help = "The size of messages sent to connected sessions"]
#[labels(db: Identity, workload: WorkloadType)]
#[help = "The size of websocket payloads sent to connected sessions"]
#[labels(db: Identity)]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to label these metrics by workload if we are sending multiple messages from potentially multiple workloads in a single payload. I'm calling this change out in case we're using this metric for billing.

@joshua-spacetime joshua-spacetime requested a review from gefjon May 19, 2026 01:12
@joshua-spacetime joshua-spacetime force-pushed the joshua/batch-server-side-sends branch from d318465 to af242c1 Compare May 19, 2026 01:15
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