clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.41k stars 110 forks source link

Websocket API: Light transaction updates & `NoSuccessNotify` #1812

Closed Centril closed 2 weeks ago

Centril commented 1 month ago

Description of Changes

Does two things:

  1. Adds TransactionUpdateLight that consists only of the request_id and the DatabaseUpdate<F>. This is emitted when the query param &light=true is set (unless the update is sent to the caller in which case a full update is sent).
  2. Adds flags: enum CallReducerFlags { FullUpdate, NoSuccessNotify } to ClientMessage. When NoSuccessNotify is set, the host will not send back an empty update to the caller on success without the caller having subscribed to any affected queries. This is exposed in the SDK via ctx.set_reducer_flags.my_reducer(CallReducerFlags::NoSuccessNotify). When the default FullUpdate is used, full updates are sent, whether the caller was subscribed to the relevant queries or not.

TODO:

API and ABI breaking changes

This breaks the websocket API/protocol.

bfops commented 1 month ago

Looks like the tests are failing?

bfops commented 1 month ago

@Centril I'm happy to review the CLI changes - Do you have recommendations on how to test this? Should I just regenerate bindings for an example client for each language?