connect method
Implementation
Future<void> connect() async {
if (_socketSub != null) {
return;
}
_socket = IOWebSocketChannel.connect(config.uri);
_socketSub = _socket!.stream.listen((message) {
final parsed = IncommingMessage.parse(message);
_handleMessage(parsed);
});
_socketSub?.onError(handleError);
_socketSub?.onDone(() async {
_socketSub = null;
await Future.delayed(config.retryDelay);
if (_disposed) return;
connect();
});
}