ThrottleWebSocketChannel.connect constructor

ThrottleWebSocketChannel.connect(
  1. Uri uri, {
  2. required ThrottleController controller,
  3. Iterable<String>? protocols,
})

Opens a throttled connection to uri in one call.

Equivalent to wrapping WebSocketChannel.connect(uri) and using uri as the URL for rule matching and log display:

final socket = ThrottleWebSocketChannel.connect(
  Uri.parse('wss://example.com/socket'),
  controller: controller,
);

Implementation

factory ThrottleWebSocketChannel.connect(
  Uri uri, {
  required ThrottleController controller,
  Iterable<String>? protocols,
}) {
  return ThrottleWebSocketChannel(
    WebSocketChannel.connect(uri, protocols: protocols),
    controller: controller,
    url: uri,
  );
}