pub struct WebSocket<B = RequestBody>where
B: BodyStream,{ /* private fields */ }
Implementations§
Source§impl<B> WebSocket<B>where
B: BodyStream,
impl<B> WebSocket<B>where
B: BodyStream,
Sourcepub fn set_ping_interval(&mut self, dur: Duration) -> &mut Self
pub fn set_ping_interval(&mut self, dur: Duration) -> &mut Self
Set interval duration of server side ping message to client.
Sourcepub fn set_max_unanswered_ping(&mut self, size: u8) -> &mut Self
pub fn set_max_unanswered_ping(&mut self, size: u8) -> &mut Self
Set max number of consecutive server side ping messages that are not answered by client.
§Panic:
when 0 is passed as argument.
Sourcepub fn msg_sender(&self) -> &ResponseSender
pub fn msg_sender(&self) -> &ResponseSender
Get a reference of Websocket message sender. Can be used to send message to client.
Sourcepub fn on_msg<F>(&mut self, func: F) -> &mut Self
pub fn on_msg<F>(&mut self, func: F) -> &mut Self
Async function that would be called when new message arrived from client.
Trait Implementations§
Source§impl<'a, 'r, C, B> FromRequest<'a, WebContext<'r, C, B>> for WebSocket<B>where
C: 'static,
B: BodyStream + Default + 'static,
impl<'a, 'r, C, B> FromRequest<'a, WebContext<'r, C, B>> for WebSocket<B>where
C: 'static,
B: BodyStream + Default + 'static,
Source§impl<'r, C, B> Responder<WebContext<'r, C, B>> for WebSocket<B>where
B: BodyStream + 'static,
impl<'r, C, B> Responder<WebContext<'r, C, B>> for WebSocket<B>where
B: BodyStream + 'static,
Auto Trait Implementations§
impl<B> Freeze for WebSocket<B>where
B: Freeze,
impl<B = RequestBody> !RefUnwindSafe for WebSocket<B>
impl<B = RequestBody> !Send for WebSocket<B>
impl<B = RequestBody> !Sync for WebSocket<B>
impl<B> Unpin for WebSocket<B>where
B: Unpin,
impl<B = RequestBody> !UnwindSafe for WebSocket<B>
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