pub struct RealtimeOptions {
pub api_key: String,
pub url: String,
pub reconnect: Option<ReconnectOptions>,
pub heartbeat: Option<HeartbeatOptions>,
pub token_provider: Option<TokenProvider>,
pub auth_in_query: bool,
pub compression: bool,
}realtime and (crate features realtime or webhooks) only.Expand description
Configuration for a RealtimeClient.
Fields§
§api_key: StringRadion API key, sent as the X-API-Key header.
url: StringWebSocket endpoint. Defaults to DEFAULT_WS_URL.
reconnect: Option<ReconnectOptions>Reconnect policy, or None to disable auto-reconnect.
heartbeat: Option<HeartbeatOptions>Heartbeat policy, or None to disable heartbeats.
token_provider: Option<TokenProvider>User JWT provider for the public-key (pk_jwt_) flow. None = secret
key. Resolved on every (re)connect.
auth_in_query: boolSend credentials in the URL query instead of headers. Defaults to
false; enable for header-stripping proxies or gateways.
compression: boolcompression only.Ask the server for zlib-compressed binary frames. Defaults to false.
Implementations§
Source§impl RealtimeOptions
impl RealtimeOptions
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Options for the given API key with default URL, reconnect, and heartbeat.
Sourcepub fn reconnect(self, options: ReconnectOptions) -> Self
pub fn reconnect(self, options: ReconnectOptions) -> Self
Tune the reconnect policy.
Sourcepub fn disable_reconnect(self) -> Self
pub fn disable_reconnect(self) -> Self
Disable auto-reconnect.
Sourcepub fn heartbeat(self, options: HeartbeatOptions) -> Self
pub fn heartbeat(self, options: HeartbeatOptions) -> Self
Tune the heartbeat policy.
Sourcepub fn disable_heartbeat(self) -> Self
pub fn disable_heartbeat(self) -> Self
Disable heartbeats.
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Set a static user JWT for the public-key (pk_jwt_) flow.
Sourcepub fn token_provider(self, provider: TokenProvider) -> Self
pub fn token_provider(self, provider: TokenProvider) -> Self
Set a user JWT provider, called on every (re)connect for a fresh token.
Sourcepub fn auth_in_query(self, enabled: bool) -> Self
pub fn auth_in_query(self, enabled: bool) -> Self
Send credentials in the URL query string instead of headers.
Sourcepub fn compression(self, enabled: bool) -> Self
Available on crate feature compression only.
pub fn compression(self, enabled: bool) -> Self
compression only.Ask the server for zlib-compressed binary frames.
Adds compress=zlib to the connect URL. The server then sends event
frames as binary zlib, which the client inflates before parsing. Text
frames still work, so mixed traffic is fine.
Trait Implementations§
Source§impl Clone for RealtimeOptions
impl Clone for RealtimeOptions
Source§fn clone(&self) -> RealtimeOptions
fn clone(&self) -> RealtimeOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more