Skip to main content

WsIoServerBuilder

Struct WsIoServerBuilder 

Source
pub struct WsIoServerBuilder { /* private fields */ }
Expand description

Builder for configuring and creating a WsIoServer.

Server-level settings become the defaults inherited by namespaces created from the server. Namespace builders may override most of these values per namespace.

Implementations§

Source§

impl WsIoServerBuilder

Source

pub fn broadcast_concurrency_limit( self, broadcast_concurrency_limit: usize, ) -> Self

Sets the default maximum number of broadcast send operations to run at once.

This value is inherited by namespace builders and passed to StreamExt::for_each_concurrent; 0 is treated as no concurrency limit.

Source

pub fn build(self) -> WsIoServer

Builds a WsIoServer with the accumulated configuration.

Source

pub fn http_request_upgrade_timeout(self, duration: Duration) -> Self

Sets the default timeout for a matched HTTP request to finish the WebSocket upgrade.

The timeout wraps the HTTP adapter’s upgrade future. Namespace builders inherit this value and may override it.

Source

pub fn init_request_handler_timeout(self, duration: Duration) -> Self

Sets the default maximum duration allowed for init-request handlers.

Init-request handlers are registered per namespace with WsIoServerNamespaceBuilder::with_init_request.

Source

pub fn init_response_handler_timeout(self, duration: Duration) -> Self

Sets the default maximum duration allowed for init-response handlers.

Init-response handlers are registered per namespace with WsIoServerNamespaceBuilder::with_init_response.

Source

pub fn init_response_timeout(self, duration: Duration) -> Self

Sets the default timeout for waiting on a client init-response packet.

This timeout starts after the server sends its init packet. Namespace builders inherit this value and may override it.

Source

pub fn middleware_execution_timeout(self, duration: Duration) -> Self

Sets the default maximum duration allowed for namespace middleware.

Middleware is registered per namespace with WsIoServerNamespaceBuilder::with_middleware.

Source

pub fn on_close_handler_timeout(self, duration: Duration) -> Self

Sets the default maximum duration allowed for per-connection close handlers.

This applies to handlers registered through WsIoServerConnection::on_close.

Source

pub fn on_connect_handler_timeout(self, duration: Duration) -> Self

Sets the default maximum duration allowed for namespace on-connect handlers.

On-connect handlers are registered per namespace with WsIoServerNamespaceBuilder::on_connect.

Source

pub fn packet_codec(self, packet_codec: WsIoPacketCodec) -> Self

Sets the default packet codec for namespaces.

The codec is used for ws.io protocol packets and init payload data. Namespace builders inherit this value and may override it.

Source

pub fn request_path(self, request_path: impl AsRef<str>) -> Self

Sets the HTTP request path handled by the server adapter.

Requests whose URI path does not match this value pass through to the wrapped service. Client namespace routing is carried separately in the namespace query parameter.

Source

pub fn websocket_config(self, websocket_config: WebSocketConfig) -> Self

Replaces the default Tungstenite WebSocket configuration.

Namespace builders inherit this value. It controls transport limits and buffer sizes and is also used to derive internal channel capacity from the configured max-write/write-buffer ratio.

Source

pub fn websocket_config_mut<F: FnOnce(&mut WebSocketConfig)>(self, f: F) -> Self

Mutates the current default Tungstenite WebSocket configuration in place.

Prefer this when you want to adjust one or two fields while keeping the builder defaults for the rest.

Trait Implementations§

Source§

impl Debug for WsIoServerBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V