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. Frames added in one turn of the event loop are written together, from the isolate's own thread whenever the socket can take them at once. 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.