You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you may be aware there is issue with WebSocketChannel (dart-lang/http#1614) that makes it impossible to determine if we are either connected or still connecting to the ws. (maybe want to make another issue for that one to not forget about it once it is fixed on web_socket_channel's side)
Although right now when network is unreachable we are not getting any error while trying to connect it and therefore it says we are connected even though we are not.
This issue might be caused by the incorrect status as mentioned in the first point. While disconnecting/closing the channel there is currently no timeout so when network is unreachable and we want to close the channel/connection we are being stuck with the status connected.
The workaround for the 2nd point could be:
Future<void> close([int code, String reason]) async {
/// Close listener and websocket.await _channelListener?.cancel();
awaitFuture.any([
_channel?.sink?.close(code, reason),
Future.delayed(
constDuration(milliseconds:5000), // make the timeout configurable?
),
]);
/// Update the connection status.
status =Status.CLOSED;
_statusController.add(status);
}
Might be a better way to handle that though. Maybe we should set status closed regardless of the _channel?.sink?.close(code, reason) outcome? Or should it be actually fixed in the web_socket_channel somehow?
The text was updated successfully, but these errors were encountered:
As you may be aware there is issue with WebSocketChannel (dart-lang/http#1614) that makes it impossible to determine if we are either connected or still connecting to the ws. (maybe want to make another issue for that one to not forget about it once it is fixed on web_socket_channel's side)
Although right now when network is unreachable we are not getting any error while trying to connect it and therefore it says we are connected even though we are not.
This issue might be caused by the incorrect status as mentioned in the first point. While disconnecting/closing the channel there is currently no timeout so when network is unreachable and we want to close the channel/connection we are being stuck with the status connected.
The workaround for the 2nd point could be:
Might be a better way to handle that though. Maybe we should set status closed regardless of the
_channel?.sink?.close(code, reason)
outcome? Or should it be actually fixed in theweb_socket_channel
somehow?The text was updated successfully, but these errors were encountered: