Open davidpanic opened 2 years ago
Started having the same issue, popping more often than I anticipated
I tried to wrap this with try-catch, but the Future.wait
in the dispose()
does not have an error handler, so the error is captured by the zone.
/// Connects or reconnects to the server with the specified headers.
void _connectOrReconnect(String token) {
try {
_connection?.client.dispose();
} catch (e, s) {
_log.e('Error closing connection', e, s);
}
_connection = _Connection(
...
);
}
Will this be fixed? It's kind of a bummer to have errors that can't even be handled because of the missing await...
Describe the issue Sometimes when running connectOrReconnect on a websocket link instance it throws an exception. I think it happens if you call it too fast - before it has a chance to initialize.
To Reproduce
WebSocketLink.connectOrReconnect()
(not exactly sure what the required timing is)Expected behavior I expect the function to cleanly reconnect the link.
device / execution context iOS 15.6.1 on an iPhone 11 Pro Max.
Other useful/optional fields
Stacktrace:
```dart ValueStreamError: ValueStream has no value. You should check ValueStream.hasValue before accessing ValueStream.value, or use ValueStream.valueOrNull instead. File "behavior_subject.dart", line 146, in BehaviorSubject.value File "websocket_client.dart", line 251, in SocketClient._closeSocketChannel File "websocket_client.dart", line 393, in SocketClient.dispose File "websocket_link.dart", line 40, in WebSocketLink.connectOrReconnect ```additional context