upgradeWebSocket function

Future<WebSocket> upgradeWebSocket(
  1. HttpRequest req, {
  2. String? protocol,
  3. int maxMessageSize = 16 * 1024 * 1024,
})

Accepts the WebSocket upgrade of req on the server Dox runs on (dox_http_native, or the server of startServer(server:)). For the raw handler of a Route.mount (like Socket.IO): Route.websocket does this itself. protocol is the subprotocol to answer with. A message or frame over maxMessageSize bytes closes the socket with 1009.

Implementation

Future<WebSocket> upgradeWebSocket(
  HttpRequest req, {
  String? protocol,
  int maxMessageSize = 16 * 1024 * 1024,
}) => DoxServer.adapter.upgradeWebSocket(req, protocol, maxMessageSize);