connect static method

Future<WebSocket> connect(
  1. Uri uri, {
  2. Map<String, dynamic>? headers,
  3. Iterable<String>? protocols,
})

Create a new WebSocket connection. The given uri must use the scheme ws or wss.

Specify the subprotocols the client is willing to speak via protocols.

Additional headers to be used in setting up the connection can be specified in headers. This only applies to server-side usage. See dart:io's WebSocket for more information.

Implementation

static Future<WebSocket> connect(Uri uri,
        {Map<String, dynamic>? headers, Iterable<String>? protocols}) =>
    MockWebSocketInternal.handleWebSocketConnection(uri,
        headers: headers, protocols: protocols);