connect method

void connect()

Implementation

void connect() {
  try {
    final socket =
        WebSocketChannel.connect(Uri.parse(url), protocols: ['websocket']);
    _client = Peer(
      socket.cast<String>(),
      onUnhandledError: (error, stackTrace) {
        assert(() {
          print('Error: $error with stackTrace: $stackTrace');
          return true;
        }());
      },
    );
    _client.listen();
  } catch (e) {
    assert(() {
      print(e);
      return true;
    }());
  }
}