connect method
Implementation
@nonVirtual
Future<void> connect() async {
if (protocolState == KuzzleProtocolState.offline) {
abortConnection = false;
protocolState = KuzzleProtocolState.connecting;
}
do {
if (abortConnection) {
protocolState = KuzzleProtocolState.offline;
throw KuzzleError(
'Unable to connect to kuzzle server at ${uri.toString()}: Connection aborted.');
}
try {
await protocolConnect();
_clientConnected();
return;
// ignore: avoid_catches_without_on_clauses
} catch (e) {
emit(ProtocolEvents.NETWORK_ERROR, [e]);
await Future.delayed(reconnectionDelay);
}
} while (protocolState != KuzzleProtocolState.connected);
}