Struct reconnecting_websocket::SocketBuilder
source · pub struct SocketBuilder<I, O> { /* private fields */ }
Expand description
Builder for Socket
Uses the DEFAULT_* consts for backoff and retry config
Implementations§
source§impl<I, O> SocketBuilder<I, O>
impl<I, O> SocketBuilder<I, O>
sourcepub fn new(url: String) -> Self
pub fn new(url: String) -> Self
Create a new builder from the given url with other config set to defaults
sourcepub fn set_backoff_min(self, backoff_min: Duration) -> Self
pub fn set_backoff_min(self, backoff_min: Duration) -> Self
Update the minimum backoff duration (must be > 0 millis)
sourcepub fn set_backoff_max(self, backoff_max: Option<Duration>) -> Self
pub fn set_backoff_max(self, backoff_max: Option<Duration>) -> Self
Update the maximum backoff duration (if set must be < u32::MAX millis)
sourcepub fn set_max_retries(self, max_retries: u32) -> Self
pub fn set_max_retries(self, max_retries: u32) -> Self
Update the maximum number of retry attempts
sourcepub fn open(self) -> Result<Socket<I, O>, Error<I, O>>
pub fn open(self) -> Result<Socket<I, O>, Error<I, O>>
Attempts to create a reconnecting websocket and do the initial open
It’s set up to error at this poing because the kind of errors that can occur here are likely
fatal (See gloo::net::websocket::futures::WebSocket::open
for details). These could
be panics but the consumer may want to display the error to the user or fallback to
plain http
Trait Implementations§
Auto Trait Implementations§
impl<I, O> Freeze for SocketBuilder<I, O>
impl<I, O> RefUnwindSafe for SocketBuilder<I, O>where
I: RefUnwindSafe,
O: RefUnwindSafe,
impl<I, O> Send for SocketBuilder<I, O>
impl<I, O> Sync for SocketBuilder<I, O>
impl<I, O> Unpin for SocketBuilder<I, O>
impl<I, O> UnwindSafe for SocketBuilder<I, O>where
I: UnwindSafe,
O: UnwindSafe,
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