Expand description
One WebSocket session: INIT, then PUB / SUB / UNSUB until close.
Binary frames are refused and the socket is closed. A parse error on
a text frame is -ERR Illegal-Argument and the session stays up.
A failed INIT closes it.
StructsΒ§
- LiveSub πOne client SUB: the engine key and the task that forwards MSG frames.
- Route
Warnings πUnroutable publishes and invalid payloads, tracked separately. - Seen
Routes πRoutes this connection has already been warned about. - Session πOne accepted WebSocket and the engine handle it publishes through.
- Violation
Wording πThe wording that differs between a violation found in what the producer put on the bus and one found in whatxml_baselineconversion produced.
EnumsΒ§
- Fatal πEnd the WebSocket after an
-ERRthat the spec treats as fatal. - Report πWhether an unroutable publish is worth reporting yet.
- State π
- Verdict πWhat the caller of
handle_violationsshould do with the delivery.
ConstantsΒ§
- OWP_
VERSION πProtocol version this server speaks. INIT must list it.
FunctionsΒ§
- cap_
notice πSay when a tracker has stopped naming routes, so a quiet log is not mistaken for a quiet client. - deadline_
elapsed πResolves oncedeadlinepasses, or never when it isNone(the timeout disabled). Used as one arm of the sessionselect!. - err_op πBuilds a
-ERRframe.detailsis the rest of the line when set. - handle_
init πNegotiates INIT. Success sends INFO (and +OK when verbose). - handle_
pub πPublishes onto the engine. A bad payload is-ERR Invalid-Messageand the session stays up. - handle_
sub πSubscribes the engine and spawns a forwarder that writes MSG frames. - handle_
text πDispatches one client text frame. - handle_
unsub πAborts the forwarder and unsubscribes. Unknownsidis-ERR. - handle_
violations πAppliesvalidateβs policy toviolations: inRejectmode, sends a-ERRand reportsVerdict::Drop; inWarnmode, only logs. Either way the warning is logged once per subscription, vialogged. - info_
payload πBuilds INFO. The service UUID is v5 of the clientβsservice_id. - negotiate πChecks INIT.versions contains
OWP_VERSIONand INIT.schema matches whenOwpConfig::schemais set. - publish_
owp πMaps one PUB onto one or two engine envelopes and publishes them. - run πRuns
sessionuntil shutdown, close, or a fatal protocol error. - send πQueues
opfor the writer. A full or closed channel is ignored so a slow client cannot stall the read loop.