-
Notifications
You must be signed in to change notification settings - Fork 404
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
[BUG] websocket 重连后,有一定概率前后端不可交互 #2919
Comments
@pipiiiiii @erha19 好像这里还有另一个问题,在断网或者休眠时,有一定概率丢失请求数据。 这块 websocket 超时需要 120s,但是期间 this._ws.readyState 还是ok的,在此期间前端的发的请求不会放到 _messageQueue,如果 websocket 超时, 会丢失这部分数据。 |
@piLurk 由于重连导致的一些问题之前修过一些
|
如果想要调试重连的问题,可以在 https://github.com/opensumi/core/blob/main/packages/core-browser/src/bootstrap/connection.ts#L61 这里主动调用重连 setTimeout(() => {
// @ts-ignore
wsChannelHandler.connection.reconnect();
}, 30 * 1000); |
@pipiiiiii 业务层有做数据恢复么,我理解可能还不能解决这个问题。。 |
目前并没有做数据恢复,增加超时时间可以防止发出去没有消息返回导致代码一直等待执行的问题。 |
对于没有返回值的 WS 消息,是不是可以有个 buffer 缓存,再重连阶段重新发一下(目前好像是超时直接返回,有点矛盾) |
https://github.com/opensumi/core/blob/main/packages/core-node/src/connection.ts#L50 |
不过或许可以在断连时将已经发出的去消息全部 reject ,不用等超时 |
描述你的问题(Describe the bug)
在 websocket 重连后,有两个长连接,有一定概率前后端不可交互
看下下代码,依赖了一个 reconnecting-websocket 包, 直接在创建长连接时就释放 block 了,是不是需要等上一个长连接请求 close 或者 error

复现路径(To Reproduce)
预期表现(Expected behavior)
websocket 重连后,前后端可交互
The text was updated successfully, but these errors were encountered: