connect method

Future<void> connect(
  1. String id,
  2. Channel channel
)

Implementation

Future<void> connect(String id, Channel channel) async {
  final ioChannel =
      IOWebSocketChannel.connect(channel.uri, headers: _getHeaders(channel));
  channel.client = ioChannel.innerWebSocket;
  channel.initialize();

  if (channel.client != null) {
    channel.handler.onConnect(channel.client!);
  }
  _channels.putIfAbsent(id, () => channel);
}