start method
Implementation
@override
Future<void> start() async {
await _channelSession.ready;
final eventInvoker = EventInvoker(_eventBook);
_shareConnectionState(ConnectionState.online);
eventInvoker.invoke(EventData("connected", {}, {}));
log("Connected", name: "ZapClient");
_subscription = _connectionStream.listen(
(data) {
final eventData = Validators.convertAndValidate(data);
eventInvoker.invoke(eventData);
},
cancelOnError: true,
onDone: () {
_shareConnectionState(ConnectionState.offline);
eventInvoker.invoke(EventData("disconnected", {}, {}));
log("Disconnected", name: "ZapClient");
_subscription?.cancel();
});
}