2.2 KiB
Binary Hub Protocol (wire) — TODO
Priority legend
- P0 blocker · P1 important · P2 nice-to-have · P3 idea
TODO-01: SegmentBufferReader isolated unit tests
Priority: P1 · Type: Test coverage
Original vast-brewing-moonbeam refactor plan (chunked receive-path) listed these tests in its verification section; they were never written. Needed:
Write/TryAdvanceSegment/Completebasic contract- Producer-consumer concurrency (grow-buffer handoff race)
- Missed-signal double-check pattern under
ManualResetEventSlimreset Disposelifecycle (buffer pool return, old-buffer cleanup)
TODO-02: Chunked protocol integration test
Priority: P1 · Type: Test coverage
End-to-end round-trip:
WriteMessageChunked(obj, AsyncSegment)→ bytesTryParseMessage(bytes)→ reconstructed object- Assert structural equality with original
Cover asymmetric cases:
- AsyncSegment sender, Segment receiver
- Bytes sender, AsyncSegment receiver
- WASM-downgraded sender (Segment), server AsyncSegment receiver
TODO-03: BinaryProtocolMode.Auto wire-detection implementation
Priority: P3 · Type: Feature · Related: SIGNALR_TODO.md#todo-04
Client-side adaptive mode: on first received message, inspect first payload byte:
CHUNK_START (200)→ peer uses AsyncSegment → match it on subsequent sends (subject to local-platform constraint — WASM safety-net overrides to Segment)- Non-chunked → stay with Segment/Bytes
Per-HubConnection state. Requires changes to BinaryProtocolMode enum + detection wiring in TryParseMessage.
TODO-04: SignalR handshake-extension for upfront mode negotiation
Priority: P3 · Type: Feature · Related: TODO-03
Alternative to wire-detection: use SignalR handshake message's extensions JSON field to carry protocol-capability info — e.g.
{ "protocol": "acbinary", "version": 1, "extensions": { "acbinary": { "preferredMode": "AsyncSegment" } } }
Zero first-message overhead, fully explicit. Both sides advertise their send-modes; pick intersection. Specification to be drafted; compatibility with non-AC clients (pure JSON etc.) must remain.