FAForever / server

The servercode for the Forged Alliance Forever lobby
http://www.faforever.com
GNU General Public License v3.0
66 stars 61 forks source link

Consider using msgspec library for structured message serialization #947

Open Askaholic opened 1 year ago

Askaholic commented 1 year ago

Today I stumbled upon this library for doing json encoding/decoding in Python. Rewriting our message handling to use it could have many benefits, most importantly making it easier to document what the message format actually looks like as each message would become a class with explicit fields.

The Library: https://github.com/jcrist/msgspec

Features we need that it has:

Other features:

Sheikah45 commented 1 year ago

I think this is definitely a step up from what we currently have.

Although I personally have always like the idea of some cross language specification like google protobuf that provides a json or binary format. Mainly with the idea that it would help lift a lot of the burden off people who want to make implementations that interact with the server in their language of choice. If this has that capability then definitely. Of course just having a dedicated message package with the classes listed clearly with their fields already helps with that.

I know you have talked about being wary of any extra build steps which is understandable but figured I would throw it out there since this is labeled proposal.

Brutus5000 commented 1 year ago

msgpack was discussed ~2017 and we decided to not use it. JSON is simpler to read and process across plattforms (also with outlook for web, websocket, stomp). We are not in a situation where every byte counts.

Askaholic commented 1 year ago

After messing around with this library for a bit I ran into a few things that made me not want to use it: