connect static method

Future<CastSocket> connect(
  1. String host,
  2. int port, [
  3. Duration? timeout
])

Implementation

static Future<CastSocket> connect(String host, int port, [Duration? timeout]) async {
  timeout ??= Duration(seconds: 10);

  final _socket = await SecureSocket.connect(
    host,
    port,
    onBadCertificate: (X509Certificate certificate) => true, // chromecast use self-signed certificate
    timeout: timeout,
  );

  final socket = CastSocket._(_socket);
  socket._startListening();

  return socket;
}