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
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 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.
Sourcepub fn build(self) -> WsIoServer
pub fn build(self) -> WsIoServer
Builds a WsIoServer with the accumulated configuration.
Sourcepub fn http_request_upgrade_timeout(self, duration: Duration) -> Self
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.
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 allowed for init-request handlers.
Init-request handlers are registered per namespace 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 allowed for init-response handlers.
Init-response handlers are registered per namespace 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 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.
Sourcepub fn middleware_execution_timeout(self, duration: Duration) -> Self
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.
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 allowed 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 allowed for namespace on-connect handlers.
On-connect handlers are registered per namespace 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 is used for ws.io protocol packets and init payload data. Namespace builders inherit this value and may override it.
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 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.
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 is also used to derive 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.
Prefer this when you want to adjust one or two fields while keeping the builder defaults for the rest.