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 are inherited by namespaces created from the server. Namespace builders may override most settings per namespace.

Implementations§

Source§

impl WsIoServerBuilder

Source

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

Sets the default maximum number of concurrent broadcast sends.

Namespace builders inherit this value. It is passed to StreamExt::for_each_concurrent; 0 means unlimited concurrency.

Source

pub fn build(self) -> WsIoServer

Builds a WsIoServer from this builder’s configuration.

Source

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

Sets the default maximum duration for a matched HTTP request’s 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 for init-request handlers.

Namespace init-request handlers are registered with WsIoServerNamespaceBuilder::with_init_request.

Source

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

Sets the default maximum duration for init-response handlers.

Namespace init-response handlers are registered with WsIoServerNamespaceBuilder::with_init_response.

Source

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

Sets the default maximum duration for waiting for a client init response.

This 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 for namespace middleware.

Namespace middleware is registered with WsIoServerNamespaceBuilder::with_middleware.

Source

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

Sets the default maximum duration 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 for namespace on-connect handlers.

Namespace on-connect handlers are registered with WsIoServerNamespaceBuilder::on_connect.

Source

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

Sets the default packet codec for namespaces.

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

Source

pub fn packet_transformer( self, packet_transformer: WsIoPacketTransformer, ) -> Self

Sets the default packet transformer for namespaces.

A namespace builder may override it for that namespace only.

Source

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

Sets the HTTP request path handled by the server adapter.

Requests with a different URI path pass through to the wrapped service. Client namespace selection 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 derives 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.

Use this to adjust selected fields while keeping the remaining defaults.

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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.