connectToServer method
Connects to the specified server.
Specify isSecure
if you do not want to connect to a secure service.
Implementation
Future<ConnectionInfo> connectToServer(String host, int port,
{bool isSecure = true}) async {
log('connecting to server $host:$port - secure: $isSecure',
initial: initialApp);
connectionInfo = ConnectionInfo(host, port, isSecure);
final socket = isSecure
? await SecureSocket.connect(
host,
port,
onBadCertificate: onBadCertificate,
)
: await Socket.connect(host, port);
_greetingsCompleter = Completer<ConnectionInfo>();
_isServerGreetingDone = false;
connect(socket);
return _greetingsCompleter.future;
}