web_socket library

WebSockets over the same Axum listener used for HTTP.

Functions

webSocketHandler(ConnectionCallback onConnection, {Iterable<String>? protocols, Iterable<String>? allowedOrigins, Duration? pingInterval, int maxMessageSize = 1024 * 1024}) → Future<Response> Function(Request)
Shelf-style callback and options, with bounded native message queues. Use sink.addStream (or NativeWebSocketChannel.send) for backpressure. sink.add buffers in Dart and applies backpressure to the network, matching dart:io WebSocket semantics without throwing on a full queue. Messages default to at most 1 MiB.
wsHandler(WsHandler handler, {int maxMessageSize = 1024 * 1024}) → Future<Response> Function(Request)
Connects Dartvel's structured message/room API to this same transport.