clockworklabs / SpacetimeDB

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

Protobufectomy #1077

Open coolreader18 opened 2 months ago

coolreader18 commented 2 months ago

Description of Changes

Replace protobuf with bsatn.

API and ABI breaking changes

API breaking for binary clients.

Expected complexity level and risk

3 (lotsa churn)

Testing

This is dependent on the C# sdk getting updated. I feel confident that CI + a botstest with the updated sdk would get everything.

gefjon commented 2 months ago

Outstanding TODOs:

(Plus make the tests and lints pass, obviously.)

gefjon commented 1 week ago

Additional question: how do we negotiate protocol version now? I believe protobuf transparently supports changing schemas for the most part by making everything optional, but I don't think bsatn has anything like that. We should at minimum send a version number I think, either once per session or once per message...

I think we should use the WebSocket protocol for this. In the past we've been quite lax about updating the WebSocket protocol name, continuing to use v1.bin.spacetimedb even after breaking changes, but once this merges and we start providing real stability guarantees, we'll need to update the version prefix whenever we change the schema.

coolreader18 commented 6 days ago

mm, that's a good point Phoebe - I was planning on putting a enum { V1(MessageV1) } around the message but that's a better idea.

gefjon commented 1 day ago

Should we update the WebSocket text/JSON protocol to use the new schema, or maintain the existing JSON schema? I would prefer the former, but that raises the barrier to merging this PR - we'll have to make more changes in the SDKs, and also update the website.

gefjon commented 12 hours ago

Update: I now lean towards not migrating JSON to use the new schema, at least in the short term.