connectWebSocket function

  1. @Deprecated(''' This is no longer necessary as of 2.3.0 of the web_socket_channel package. To update your code from this package to the direct web_socket_channel one simply change from: final ws = await connectWebSocket(uri) to: final ws = WebSocketChannel.connect( uri, protocols: protocols, ); await ws.ready; ``` ''')
Future<WebSocketChannel> connectWebSocket(
  1. Uri uri, {
  2. Duration? connectionTimeout,
  3. Map<String, dynamic>? headers,
  4. dynamic onTimeout(
    1. EventSink
    )?,
  5. Duration? pingInterval,
  6. Iterable<String>? protocols,
})

Implementation

@Deprecated('''
This is no longer necessary as of 2.3.0 of the web_socket_channel package.  To
update your code from this package to the direct web_socket_channel one simply
change from:

  final ws = await connectWebSocket(uri)

to:

  final ws = WebSocketChannel.connect(
    uri,
    protocols: protocols,
  );

  await ws.ready;
```
''')
Future<WebSocketChannel> connectWebSocket(
  Uri uri, {
  Duration? connectionTimeout,
  Map<String, dynamic>? headers,
  Function(EventSink<dynamic>)? onTimeout,
  Duration? pingInterval,
  Iterable<String>? protocols,
}) async {
  final channel = WebSocketChannel.connect(
    uri,
    protocols: protocols,
  );

  await channel.ready;

  return channel;
}