-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The websocket server is closed, and the client does not perceive the link closing #281
Comments
We're also experiencing something similar, and any help or guidance would be sincerely appreciated. We are also utilizing
I was thinking the message the server is sending is causing the stream to pause or close, but other times it works just fine. This is happening in production behind AWS infrastructure.
No errors are being raised either. Any ideas? It'd be much appreciated! |
@leeyisoft one suggestion I've seen on some other threads is to implement a custom ping/pong so that you can reconnect if it fails. Though I'd like to still get to the bottom of what's causing, or what could cause, what we're seeing. |
@jeffscaturro-aka 我这里的情况是: 如果能够知道“客户端发送ping消息的Timer死的原因”,应该可以解决问题 我现在的解决方案是: 1 在 WebSocket单例中添加一个 lastConnectedAt 属性; 这样不完美,但是可以缓解问题 ··· 项目是全开源的,但是要运行清理,需要自己配置服务端(做了很多安全校验相关的功能,APP端没有对应的服务端的密钥,没法直接运行) |
The client's pingIntervals need to be smaller than the server's idle_timeout, taking into account the network round-trip time 客户端的 pingIntervals 需要比 服务端 idle_timeout 小一些,网络往返时间考虑进去 |
@leeyisoft Thank you for the additional information! While your strategy does seem to be a valid approach in having the client reconnect, it does seem to be our situations are slightly different. I'm experiencing the websocket close very shortly after the connection is opened. Just a couple seconds. I also have tried with the client's ping interval shorter than the server's, even accounting for the round-trip time. |
You can find the problem according to the WebSocket connection close code and do not know whether it is useful for you https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code |
Same error. The client does not know that the connection has been disconnected and will not try to reconnect again. |
The websocket server is closed, and the client does not perceive the link closing:
I run the macOS(desktop) version of Flutter on my MacBook and close the lid of my laptop after work.
The next morning I came back and found that isConnected was still true, that is, the websocket link status of the macOS(desktop) version of Flutter was still connected, but it was no longer sending ping to the server.
The link state of the server has long been closed, if without restarting the APP, is there any way for the program to automatically check this state and self-repair the link state as soon as possible
full code https://github.com/imboy-pub/imboy-flutter/blob/main/lib/service/websocket.dart
The text was updated successfully, but these errors were encountered: