diff options
Diffstat (limited to 'packages/meshbay-common/src')
| -rw-r--r-- | packages/meshbay-common/src/meshbay_common/protocol.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/meshbay-common/src/meshbay_common/protocol.py b/packages/meshbay-common/src/meshbay_common/protocol.py index 689adbf..6eff5b6 100644 --- a/packages/meshbay-common/src/meshbay_common/protocol.py +++ b/packages/meshbay-common/src/meshbay_common/protocol.py @@ -6,6 +6,28 @@ MHP (Mesh Bay Hub Protocol) — v0.1 All wire messages are length-prefixed msgpack (4-byte big-endian length header). Every message carries a "v" field for protocol version. + +**`req_id` — the correlation id (added 2026-09-07).** A request may carry one; +the reply to it carries the same value back, and nothing else on the wire does. +It is the caller's own key for its pending request, opaque to the node, and +unique only within one connection. + +There was none for a long time, and its absence was not neutral. A reply named +its own type and nothing else, so a caller with more than one request in flight +had to work out which one a message answered from the message itself — and the +replies that name nothing (a bare `ack`, and `{"type": "error"}`, which +webrtc_server.py sends from 240 places while two of them say what they are +about) could only be matched by arrival order. That is a guess, wrong whenever +two replies reorder, and it does not fail quietly: one request is resolved with +another's answer while the request that answer belonged to waits out its own +timeout. Live symptom (2026-09-06): a chat send whose reply went astray left +the composer disabled for thirty seconds, and the Chat tab read as frozen. + +Both halves are optional and degrade to what came before: a request without one +is answered without one, and a client that gets no id back falls back to +matching by type. Neither side may treat it as authentication or as a sequence +number — it is a label chosen by the peer, and the only thing it decides is +which local promise a reply belongs to. """ from dataclasses import dataclass, field |