Struct eventsource_client::ReconnectOptions
source · pub struct ReconnectOptions { /* private fields */ }
Expand description
Configuration for a Client
’s reconnect behaviour.
let reconnect_options = ReconnectOptions::reconnect(true)
.retry_initial(false)
.delay(Duration::from_secs(1))
.backoff_factor(2)
.delay_max(Duration::from_secs(60))
.build();
See default()
for a description of the default behaviour. See
ReconnectOptionsBuilder
for descriptions of each configurable parameter.
Implementations§
source§impl ReconnectOptions
impl ReconnectOptions
sourcepub fn reconnect(reconnect: bool) -> ReconnectOptionsBuilder
pub fn reconnect(reconnect: bool) -> ReconnectOptionsBuilder
Start building a ReconnectOptions
, by enabling or disabling
reconnection on stream error.
If reconnect
is true
(the default), the client will automatically
try to reconnect if the stream ends due to an error. If it is false
,
the client will stop receiving events after an error.
Trait Implementations§
source§impl Clone for ReconnectOptions
impl Clone for ReconnectOptions
source§fn clone(&self) -> ReconnectOptions
fn clone(&self) -> ReconnectOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ReconnectOptions
impl Debug for ReconnectOptions
source§impl Default for ReconnectOptions
impl Default for ReconnectOptions
source§fn default() -> ReconnectOptions
fn default() -> ReconnectOptions
The default reconnect behaviour is to automatically try to reconnect if the stream ends due to an error, but not to retry if the initial connection fails.
The client will wait before each reconnect attempt, to allow time for the error condition to be resolved (e.g. for the SSE server to restart if it went down). It will wait 1 second before the first attempt, and then back off exponentially, up to a maximum wait of 1 minute.
Auto Trait Implementations§
impl Freeze for ReconnectOptions
impl RefUnwindSafe for ReconnectOptions
impl Send for ReconnectOptions
impl Sync for ReconnectOptions
impl Unpin for ReconnectOptions
impl UnwindSafe for ReconnectOptions
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)