onConnection

External Documentation

void onConnection(

  1. void handler(
    1. WebSocketClient client,
    2. String? url
    )
)

Registers a handler for new client connections

Implementation

void onConnection(
  void Function(WebSocketClient client, String? url) handler,
) =>
    _server.on(
      'connection',
      ((JSWebSocket ws, JSIncomingMessage request) {
        final client = WebSocketClient(ws);
        final url = _extractUrl(request);
        handler(client, url);
      }).toJS,
    );