pub struct WsConfig { /* private fields */ }
Expand description
config for WebSockets.
§example:
use actix_web::{App, HttpServer};
use actix_send_websocket::WsConfig;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(||
App::new().app_data(WsConfig::new().disable_heartbeat())
)
.bind("127.0.0.1:8080")?
.run()
.await
}
Implementations§
Source§impl WsConfig
impl WsConfig
pub fn new() -> Self
Sourcepub fn protocols(self, protocols: Vec<String>) -> Self
pub fn protocols(self, protocols: Vec<String>) -> Self
Set specific protocol strings.
protocols
is a sequence of known protocols. On successful handshake,
the returned response headers contain the first protocol in this list
which the server also knows.
Sourcepub fn timeout(self, dur: Duration) -> Self
pub fn timeout(self, dur: Duration) -> Self
Set the timeout duration for client does not send Ping for too long.
Sourcepub fn disable_heartbeat(self) -> Self
pub fn disable_heartbeat(self) -> Self
Disable heartbeat check.
Sourcepub fn enable_server_send_heartbeat(self) -> Self
pub fn enable_server_send_heartbeat(self) -> Self
Enable the heartbeat from Server side to Client.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WsConfig
impl RefUnwindSafe for WsConfig
impl Send for WsConfig
impl Sync for WsConfig
impl Unpin for WsConfig
impl UnwindSafe for WsConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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