Constructs a new secure client socket and connect it to the given
host
on port port
. The returned Future will complete with a
SecureSocket that is connected and ready for subscription.
onBadCertificate
is an optional handler for unverifiable certificates.
The handler receives the X509Certificate, and can inspect it and
decide (or let the user decide) whether to accept
the connection or not. The handler should return true
to continue the SecureSocket connection.
Source
static Future<SecureSocket> connect(
host,
int port,
{SecurityContext context,
bool onBadCertificate(X509Certificate certificate),
bool sendClientCertificate,
List<String> supportedProtocols}) {
return RawSecureSocket.connect(host,
port,
context: context,
onBadCertificate: onBadCertificate,
supportedProtocols: supportedProtocols)
.then((rawSocket) => new SecureSocket._(rawSocket));
}