Event stream: send an explicit "attached" acknowledgement so clients can register advises without racing the first event #227
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From lmxopcua#865 (2026-11-11). The gateway never replays events to a newly opened event stream. A client that subscribes (SubscribeBulk) before its stream is attached loses the initial value, which matters for slow-changing attributes such as
ScanState.OtOpcUa now opens the stream before registering and waits up to 1 s after sending the stream request. That narrows the race but can't close it, because the gateway gives no signal that the stream is attached. Please add an initial 'stream attached' message, or a per-session sequence, so clients can wait for it deterministically. Related: the #859 worker-sequence request for SubscribeBulk replies.
Done on main
afd504d5— opt-in attach ack. Proto (additive): StreamEventsRequest.emit_stream_attached = 3; MxEvent.stream_attached = 15 (StreamAttached{live_after_sequence}); capability string 'stream-events-attached-ack' in OpenSessionReply.capabilities. Sent as the first message only after the subscriber is registered with the session (before the ReplayGap sentinel on resume); never on a refused attach or when not requested.Opt-in, not always-on, because ScadaBridge's RealMxGatewayClient advances its resume cursor from every event's WorkerSequence before filtering, so an unrequested worker_sequence-0 message would reset it (latent same bug with ReplayGap filed as ScadaBridge#128). .NET client: StreamEventsAsync(…, emitStreamAttached), IsStreamAttached, SupportsStreamAttachedAck, OpenEventStreamAsync(after, attachTimeout, ct). Go/Python/Rust bindings regenerated (Java not). Tests: gateway 1446/0 (race proof verified to fail when the ack precedes registration), client 158/0, Go/Python/Rust green.
Needs an mxgw Contracts/Client release before OtOpcUa can consume it — tracked as lmxopcua#877.