Expand description
Centrifugo WebSocket client using the bidirectional protobuf protocol.
ยงExample
use wowlab_centrifuge::{Client, ClientConfig};
use wowlab_types::sensitive::Sensitive;
let token = Sensitive::new("connection-token".to_string());
let config = ClientConfig::new("https://centrifugo.example.com", token)
.name("worker")
.version("1.0.0");
let client = Client::new(config);
assert_eq!(format!("{client:?}"), "Client { inner: \"<ClientInner>\", shutdown: \"<CancellationToken>\" }");Modulesยง
- backoff ๐
- AWS-style full jitter backoff.
- client ๐
- codes ๐
- disconnect
- Codes carried by Centrifugo disconnect messages.
- error ๐
- error_
codes - Codes carried by Centrifugo command errors.
- filter ๐
- presence ๐
- proto ๐
- subscription ๐
- token ๐
- transport ๐
- types ๐
- unsubscribe
- Codes carried by server unsubscribe messages.
- ws_
close - Centrifugo application-specific WebSocket close codes.
Structsยง
- Backoff
- Exponential reconnect schedule with full jitter and bounded delays.
- Client
- Centrifugo realtime client with auto-reconnect; clones share state.
- Client
Config - Connection identity, authentication, and reconnect settings for a
crate::Client. - Client
Info - Identity and application metadata for a connected Centrifugo client.
- Connect
Result - Successful connection handshake returned by Centrifugo.
- Error
- Failure returned by the Centrifugo client.
- Filter
Error - Validation failure while constructing a publication tag filter.
- Filter
Value - A scalar value in a Centrifugo publication tag filter.
- History
Result - Publications and stream position returned by a history query.
- Presence
- HTTP client for querying Centrifugo channel presence.
- Presence
Result - Connected clients currently present on a channel, keyed by client identifier.
- Presence
Stats - Aggregate client and user counts for a channel.
- Publication
- Publication delivered through a subscription or history result.
- RpcResult
- Application payload returned by a Centrifugo RPC call.
- Stream
Position - Recoverable stream cursor for history and subscriptions.
- SubRefresh
Result - Successful subscription-token refresh response.
- Subscribe
Result - Successful subscription handshake and recovery state returned by Centrifugo.
- Subscription
- Handle for receiving events from a subscribed channel; drop to stop receiving.
- Subscription
Config - Channel subscription options and recovery settings.
- Subscription
Filter - A validated server-side publication tag filter.
- Token
Error - Failure to encode a Centrifugo JWT.
Enumsยง
- Client
Event - Event emitted by the connection lifecycle.
- Client
State - Lifecycle state of a Centrifugo connection.
- Subscription
Event - Event emitted by a channel subscription.
- Subscription
State - Lifecycle state of a channel subscription.
Functionsยง
- generate_
token - Generates a one-day Centrifugo JWT for
subject.
Type Aliasesยง
- Result
- Result returned by Centrifugo client operations.