clockworklabs / SpacetimeDB

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

Subscriptions impl, server side #1997

Open lcodes opened 1 week ago

lcodes commented 1 week ago

Description of Changes

Moving subscriptions from one batch-subscribe call to one call per subscribe with matching unsubscribe call.

API and ABI breaking changes

Updates to the websocket API and introduction of new messages.

Expected complexity level and risk

3: changes the way subscriptions are stored and used.

Testing

In progress

bfops commented 5 days ago

(Seems to be failing tests?)

gefjon commented 3 days ago

@jsdt Note there's an edge case where republishing a module with a hot-swap can remove an index, which can break an indexed semijoin subscription query, since we refuse incremental semijoins which are not indexed on both of the joined columns. The intended semantics here is that, after a hotswap, we recompile all active subscribed queries. If any of them fails to compile, like in the removed-index case, the host sends an error message to the client and then ends the subscription, but the websocket connection is not closed. Any queries that successfully compile stay in place.

Please find out if this PR implements that behavior. If it does not, please create a ticket to fix it in a follow-up.