Skip to main content

Crate wowlab_centrifuge

Crate wowlab_centrifuge 

Source
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.
ClientConfig
Connection identity, authentication, and reconnect settings for a crate::Client.
ClientInfo
Identity and application metadata for a connected Centrifugo client.
ConnectResult
Successful connection handshake returned by Centrifugo.
Error
Failure returned by the Centrifugo client.
FilterError
Validation failure while constructing a publication tag filter.
FilterValue
A scalar value in a Centrifugo publication tag filter.
HistoryResult
Publications and stream position returned by a history query.
Presence
HTTP client for querying Centrifugo channel presence.
PresenceResult
Connected clients currently present on a channel, keyed by client identifier.
PresenceStats
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.
StreamPosition
Recoverable stream cursor for history and subscriptions.
SubRefreshResult
Successful subscription-token refresh response.
SubscribeResult
Successful subscription handshake and recovery state returned by Centrifugo.
Subscription
Handle for receiving events from a subscribed channel; drop to stop receiving.
SubscriptionConfig
Channel subscription options and recovery settings.
SubscriptionFilter
A validated server-side publication tag filter.
TokenError
Failure to encode a Centrifugo JWT.

Enumsยง

ClientEvent
Event emitted by the connection lifecycle.
ClientState
Lifecycle state of a Centrifugo connection.
SubscriptionEvent
Event emitted by a channel subscription.
SubscriptionState
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.