FluidFramework
FluidFramework copied to clipboard
Prototype for binary signal support
DO NOT MERGE
This is stand-alone PR that demonstrates ability to add binary payloads to signals.
- A new submitSignal2 method is added that receives payload that could contain ArrayBuffer properties, but with exception of such properties, it is jsonable payload (i.e. could be serialized using JSON.stringify).
- Driver implementing such API is responsible can either send it on the wire as is (more on socket.io support later) or encode it all as one binary or text payload.
- Driver is supposed to decode content (on receiving) into exactly same structure. If it's a string, we assume it's either plain JSON, or content encoded with encodeJsonableOrBinary(), and thus loader will leverage decodeJsonableOrBinary() to decode it.
- Local driver change is made to support binary payloads, and new workflow. Even though none of our E22 tests implement binary payloads, it tests new responsibility of driver to own encoding.
- TBD: add actual E2E test with binary payloads to ensure whole pipeline works as expected.
What is required from service:
- Implement proper binary support, in a form that appropriate driver implements.
- If sample R11S driver change is used, appropriate service needs to support mixes payloads.
For more info about binary support by socket.io, please consult the following resources:
- https://socket.io/blog/introducing-socket-io-1-0/#binary-support talks about mixing buffers with other content in same message
- https://socket.io/how-to/upload-a-file, https://socket.io/docs/v4/socket-io-protocol/ is interesting to consult, as it sounds like payload is split into text & binary frames, and thus there could be some penalty for mixing content.
- It is worth reading through https://blog.cantremember.com/optimizing-socketio-performance-with-binary-mode, as it feels like they are solving similar problems that our clients are hitting.
Other related PRs
- https://github.com/microsoft/FluidFramework/pull/20954
- https://github.com/microsoft/FluidFramework/pull/20953
- https://github.com/microsoft/FluidFramework/pull/20956