pub struct ClientBuilder { /* private fields */ }Expand description
Builder struct for [RealtimeClient]
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
pub fn new(endpoint: impl Into<String>, access_token: impl Into<String>) -> Self
Sourcepub fn set_headers(&mut self, set_headers: HeaderMap) -> &mut Self
pub fn set_headers(&mut self, set_headers: HeaderMap) -> &mut Self
Sets the client headers. Headers always contain “X-Client-Info: realtime-rs/{version}”.
Sourcepub fn add_headers(&mut self, headers: HeaderMap) -> &mut Self
pub fn add_headers(&mut self, headers: HeaderMap) -> &mut Self
Merges provided HeaderMap with currently held headers
Sourcepub fn heartbeat_interval(&mut self, heartbeat_interval: Duration) -> &mut Self
pub fn heartbeat_interval(&mut self, heartbeat_interval: Duration) -> &mut Self
Set Duration between heartbeat packets. Default 29 seconds.
Sourcepub fn reconnect_interval(
&mut self,
reconnect_interval: ReconnectFn,
) -> &mut Self
pub fn reconnect_interval( &mut self, reconnect_interval: ReconnectFn, ) -> &mut 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
Sourcepub fn reconnect_max_attempts(&mut self, max_attempts: usize) -> &mut Self
pub fn reconnect_max_attempts(&mut self, max_attempts: usize) -> &mut Self
Configure the number of recconect attempts to be made before erroring
Sourcepub fn connection_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn connection_timeout(&mut self, timeout: Duration) -> &mut Self
Configure the duration to wait for a connection to succeed. Default: 10 seconds Minimum: 1 second
Sourcepub fn auth_url(&mut self, auth_url: impl Into<String>) -> &mut Self
pub fn auth_url(&mut self, auth_url: impl Into<String>) -> &mut Self
Set the base URL for the auth server In live supabase deployments this is the same as the endpoint URL, and defaults as such. In local deployments this may need to be set manually
Sourcepub fn max_events_per_second(&mut self, count: usize) -> &mut Self
pub fn max_events_per_second(&mut self, count: usize) -> &mut Self
Sets the max messages we can send in a second. Default: 10
pub fn encode( &mut self, encode: impl Fn(RealtimeMessage) -> RealtimeMessage + 'static + Send + Sync, ) -> &mut Self
pub fn decode( &mut self, decode: impl Fn(RealtimeMessage) -> RealtimeMessage + 'static + Send + Sync, ) -> &mut Self
Sourcepub fn build(
self,
channel_callback_event_sender: CrossbeamEventSender<ChannelCallbackEvent>,
connect_result_callback_event_sender: CrossbeamEventSender<ConnectResultCallbackEvent>,
) -> Client
pub fn build( self, channel_callback_event_sender: CrossbeamEventSender<ChannelCallbackEvent>, connect_result_callback_event_sender: CrossbeamEventSender<ConnectResultCallbackEvent>, ) -> Client
Consume the Self and return a configured [RealtimeClient]
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more