pub struct RealtimeClientBuilder { /* private fields */ }Expand description
Builder struct for [RealtimeClient]
Implementations§
Source§impl RealtimeClientBuilder
impl RealtimeClientBuilder
Sourcepub fn new(endpoint: impl Into<String>, anon_key: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>, anon_key: impl Into<String>) -> Self
Creates a new RealtimeClientBuilder
pub fn access_token(self, access_token: impl Into<String>) -> Self
Sourcepub fn set_headers(self, set_headers: HeaderMap) -> Self
pub fn set_headers(self, set_headers: HeaderMap) -> Self
Sets the client headers. Headers always contain “X-Client-Info: realtime-rs/{version}”.
Sourcepub fn add_headers(self, headers: HeaderMap) -> Self
pub fn add_headers(self, headers: HeaderMap) -> Self
Merges provided HeaderMap with currently held headers
Sourcepub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
pub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
Set Duration between heartbeat packets. Default 29 seconds.
Sourcepub fn reconnect_interval(self, reconnect_interval: ReconnectFn) -> Self
pub fn reconnect_interval(self, reconnect_interval: ReconnectFn) -> Self
Set the function to provide time between reconnection attempts The provided function should take a count of reconnect attempts and return a Duration to wait until the next attempt is made.
Don’t implement an untested timing function here in prod or you might make a few too many requests.
Defaults to stepped backoff, as shown below
fn backoff(attempts: usize) -> Duration {
let times: Vec<u64> = vec![0, 1, 2, 5, 10];
Duration::from_secs(times[attempts.min(times.len() - 1)])
}Sourcepub fn reconnect_max_attempts(self, max_attempts: usize) -> Self
pub fn reconnect_max_attempts(self, max_attempts: usize) -> Self
Configure the number of recconect attempts to be made before erroring
pub fn encode(self, encode: Interceptor) -> Self
pub fn decode(self, decode: Interceptor) -> Self
Sourcepub fn connect(self) -> ClientManager
pub fn connect(self) -> ClientManager
Consume the Self and return a configured ClientManager
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RealtimeClientBuilder
impl RefUnwindSafe for RealtimeClientBuilder
impl Send for RealtimeClientBuilder
impl Sync for RealtimeClientBuilder
impl Unpin for RealtimeClientBuilder
impl UnwindSafe for RealtimeClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more