connect method

Future<bool> connect()

Connects to the Gatekeeper server.

Returns a Future that completes with true if the connection was successful, or false if already connected.

Implementation

Future<bool> connect() async {
  if (isConnected) return false;
  var socket = _socket = await Socket.connect(host, port);

  socket.listen(_onData, cancelOnError: true, onDone: _onClose);

  return true;
}