pub struct UseWebSocketOptions {
pub onopen: Option<Box<dyn FnMut(Event)>>,
pub onmessage: Option<Box<dyn FnMut(String)>>,
pub onmessage_bytes: Option<Box<dyn FnMut(Vec<u8>)>>,
pub onerror: Option<Box<dyn FnMut(Event)>>,
pub onclose: Option<Box<dyn FnMut(CloseEvent)>>,
pub reconnect_limit: Option<u32>,
pub reconnect_interval: Option<u32>,
pub manual: Option<bool>,
pub protocols: Option<Vec<String>>,
}
Expand description
Options for WebSocket
.
Fields§
§onopen: Option<Box<dyn FnMut(Event)>>
WebSocket
connect callback.
onmessage: Option<Box<dyn FnMut(String)>>
WebSocket
message callback for text.
onmessage_bytes: Option<Box<dyn FnMut(Vec<u8>)>>
WebSocket
message callback for binary.
onerror: Option<Box<dyn FnMut(Event)>>
WebSocket
error callback.
onclose: Option<Box<dyn FnMut(CloseEvent)>>
WebSocket
close callback.
reconnect_limit: Option<u32>
Retry times. Defaults to u32::MAX
for infinite retries.
reconnect_interval: Option<u32>
Retry interval(ms). Defaults to 3000.
manual: Option<bool>
Manually starts connection
protocols: Option<Vec<String>>
Sub protocols
Trait Implementations§
Source§impl Default for UseWebSocketOptions
impl Default for UseWebSocketOptions
Source§fn default() -> UseWebSocketOptions
fn default() -> UseWebSocketOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UseWebSocketOptions
impl !RefUnwindSafe for UseWebSocketOptions
impl !Send for UseWebSocketOptions
impl !Sync for UseWebSocketOptions
impl Unpin for UseWebSocketOptions
impl !UnwindSafe for UseWebSocketOptions
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
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> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.