open method

  1. @override
Future<void> open({
  1. Duration? pingInterval,
})
override

Implementation

@override
Future<void> open({Duration? pingInterval}) async {
  _onDisconnect = Completer();
  _onConnectionLost = Completer();
  _handshakeCompleter = Completer();
  try {
    if (_ssl) {
      _socket = await SecureSocket.connect(_host, _port,
          onBadCertificate: (certificate) => _allowInsecureCertificates);
    } else {
      _socket = await Socket.connect(_host, _port);
    }
    _pingInterval = pingInterval;
    unawaited(_runPingInterval());
    _sendInitialHandshake();
  } on SocketException catch (error) {
    _onConnectionLost!.complete(error);
  }
}