Skip to main content

Module subscription

Module subscription 

Source
Expand description

Adapter-managed subscription intent and acknowledgment tracking.

SubscriptionState keeps confirmed, pending_subscribe, and pending_unsubscribe topics separate. Server acknowledgments move topics between those states; late subscribe acknowledgments do not revive cancelled intent, and stale unsubscribe acknowledgments do not remove a later resubscription. SubscriptionState::all_topics returns confirmed and pending subscribe intent for recovery, excluding pending unsubscriptions.

Reference counts are independent of acknowledgment state. The first reference tells the caller to send a subscribe request, and removing the last tells it to send an unsubscribe request. The tracker records state but never sends protocol messages.

§Topic format

Topics use channel{delimiter}symbol; the first delimiter occurrence separates the channel from the optional symbol. A topic without a delimiter represents the whole channel.

Structs§

SubscriptionSnapshot
Read-only snapshot of subscription topics grouped by channel.
SubscriptionState
Tracks subscription intent and acknowledgment state for WebSocket connections.

Functions§

split_topic
Splits a topic into channel and optional symbol using the specified delimiter.