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
impl WsIoServerBuilder
Sourcepub fn broadcast_concurrency_limit(
self,
broadcast_concurrency_limit: usize,
) -> Self
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.
Sourcepub fn build(self) -> WsIoServer
pub fn build(self) -> WsIoServer
Builds a WsIoServer from this builder’s configuration.
Sourcepub fn http_request_upgrade_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn init_request_handler_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn init_response_handler_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn init_response_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn middleware_execution_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn on_close_handler_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn on_connect_handler_timeout(self, duration: Duration) -> Self
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.
Sourcepub fn packet_codec(self, packet_codec: WsIoPacketCodec) -> Self
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.
Sourcepub fn packet_transformer(
self,
packet_transformer: WsIoPacketTransformer,
) -> Self
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.
Sourcepub fn request_path(self, request_path: impl AsRef<str>) -> Self
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.
Sourcepub fn websocket_config(self, websocket_config: WebSocketConfig) -> Self
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.
Sourcepub fn websocket_config_mut<F: FnOnce(&mut WebSocketConfig)>(self, f: F) -> Self
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.