popsub_sdk
The Rust client for PopSub, a WebSocket publish/subscribe broker with per-topic permissions, durable sessions and at-least-once delivery.
The client handles what every application would otherwise write itself: logging in and refreshing the token, reconnecting with backoff (and not reconnecting when the server's close code says not to), resubscribing without gaps, resending confirmed publishes without duplicating them, acknowledging QoS 1 messages, and making sure each (topic, seq) reaches the application once.
[]
= "0.2"
= { = "1", = ["macros", "rt-multi-thread"] }
use ;
async
cargo run -p popsub_sdk --example subscribe and --example publish run the same thing against a local server; the repository's examples/README.md walks through it.
Bodies that aren't text go through publish_bytes and publish_bytes_confirmed, and come back through Message::bytes.
Also on Client and ClientConfig:
subscribe_shared(topic, group, from)joins a shared subscription: the group's members split the topic's messages.subscribeaccepts a wildcard pattern (orders/#,sensors/+/temp) and yields every matching topic's messages, each under its own topic andseq.events()reports connects, disconnects, truncations, stalls, token refreshes, subscriptions the server ended and server errors.admin()sends the admin requests for accounts, grants and topics. They are never queued or resent.ack_mode(AckMode::Manual)leaves acknowledging to the application, throughMessage::ack.add_root_certificates_pemtrusts a private CA forwss://.
What the delivery guarantees are, and where they stop, is in the repository's design document. Version 0.x: the protocol and this API may still change between minor versions.
Licensed under Apache-2.0.