Files
Tyler Cloutier 184d4e9d3f Implement server-side support for the v2 websocket protocol (#4213)
# Description of Changes

This adds the v2 websocket protocol and adds support on the server side.
For context on many of the changes/decisions, you can look at the
discussion on https://github.com/clockworklabs/SpacetimeDB/pull/4023.

To restate some of the key changes:
- The reducer event information is no longer sent with transaction
updates (because we don't want to broadcast reducer call information
anymore).
- If a client calls a reducer, they are sent a `ReducerResult` which
includes the outcome of the reducer call and and related row updates for
queries that the client is subscribed to.
- We no longer dedupe queries that appear in multiple query sets for the
same client. This is because we are moving toward per-query storage.
- Related to that, Unsubscribe requests have an option to send the
related rows. We need this for now, since clients don't have per-query
storage implemented yet.
 - We don't have the json format in v2.

Notes for reviewers:
- This moves around the messages in
`crates/client-api-messages/src/websocket` (into `common`, `v1`, and
`v2`), and this renaming of existing messages adds a lot of noise to the
PR.
- In many places, I chose to duplicate a lot of code to have a v1
version and a v2 version. I went with this to make it easier to remove
the v1 version in the future (hopefully we can just fully delete most of
the v1 functions).
- `module_subscription_manager.rs` has probably has the biggest changes,
since we now track queries by query_set_id, and we get to remove some
complexity of v1's FormatSwitch.

<!-- Please describe your change, mention any related tickets, and so on
here. -->

# API and ABI breaking changes

The v1 protocol still works, though we won't send the reducer event info
for v10 modules.

# Expected complexity level and risk

4. This touches a lot of places.

# Testing

Unit testing is pretty minimal for the new code paths. I've done some
manual e2e testing with the typescript quickstart, and this has been
tested with a different branch implementing the v2 rust client.

---------

Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2026-02-12 20:39:26 +00:00

42 lines
1009 B
TOML

[package]
name = "spacetimedb-testing"
version.workspace = true
edition.workspace = true
license-file = "LICENSE"
publish = false
[features]
allow_loopback_http_for_tests = ["spacetimedb-standalone/allow_loopback_http_for_tests"]
[dependencies]
spacetimedb-cli.workspace = true
spacetimedb-data-structures.workspace = true
spacetimedb-lib.workspace = true
spacetimedb-core.workspace = true
spacetimedb-standalone.workspace = true
spacetimedb-client-api.workspace = true
spacetimedb-client-api-messages.workspace = true
spacetimedb-paths.workspace = true
spacetimedb-schema.workspace = true
anyhow.workspace = true
bytes.workspace = true
env_logger.workspace = true
log.workspace = true
clap.workspace = true
serde_json.workspace = true
tokio.workspace = true
wasmbin.workspace = true
duct.workspace = true
lazy_static.workspace = true
rand.workspace = true
tempfile.workspace = true
serde.workspace = true
futures.workspace = true
[dev-dependencies]
serial_test.workspace = true
[lints]
workspace = true