-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Note
"Serialization" and "deserialization" as used in phare.serialize refers to conversion of dataclasses from and to JSON-style dicts (the MessagePack encoding is handled separately already). Ideally we would find a better name to avoid confusion here.
The current implementation does not handle deserialization very well yet and just dumps the payload verbatim into the ServerMessage.payload field. We should improve this by checking for known formats and deserializing them (e.g. InputEvent).
The main challenge would be figuring out a way to do this without coupling the serialization machinery (phare.serialize) too much to the protocol itself. In the Rust and Swift implementations of this API we use an enum with associated values (see here and here) to model this, perhaps we could use a Union to emulate this ADT-style approach in Python?