fix(wasm): recover msg_gateway errCode when WebSocket dial fails - #1114
Open
csc-EricWu wants to merge 6 commits into
Open
csc-EricWu wants to merge 6 commits into
csc-EricWu wants to merge 6 commits into
Conversation
Browser WebSocket upgrades do not expose the HTTP error body, so WASM clients only saw NetworkError 10000 for token failures like 1507. Probe the handshake URL over HTTP and pass the real errCode to OnConnectFailed. Co-authored-by: Cursor <cursoragent@cursor.com>
Older wasm-client-sdk builds only pass operationID into APIs that now
expect a pagination req string; undefined becomes "<undefined>" and
breaks json.Unmarshal. Normalize null/undefined to "{}" in ReflectCall.
Co-authored-by: Cursor <cursoragent@cursor.com>
主动登出原先 SendReqWaitResp 最长阻塞 20s;在 js/wasm(尤其 Safari) 上会卡死主线程甚至导致刷新无效。改为 SendReqNoWait 尽力通知服务端回收 推送 token,并在 Exit 后立即结束 writePump 的等待。 Co-authored-by: Cursor <cursoragent@cursor.com>
js/wasm 上 KickOnline 后若立刻 DispatchLogout(关库/关连接/initResources), 易与业务层页面跳转叠在一起卡死 Mobile Safari。改为仅回调 OnKickedOffline, 由页面硬跳卸载;并跳过踢线后的底层 websocket.Close,以及 IndexDB Worker close。 原生平台行为保持不变:OnKickedOffline 后仍 DispatchLogout。 Co-authored-by: Cursor <cursoragent@cursor.com>
通知里 versionID 为空会走全量成员同步并丢弃群资料;同步前回退路径先应用 ExtraData,并修正 ZDebug 参数不成对的日志错误。 Co-authored-by: Cursor <cursoragent@cursor.com>
按 seq 补洞时一次最多可拉 50 条,群通知等 payload 较大时 WebSocket 二进制回包在 Safari 上会被截断,导致 gob decode unexpected EOF、长连接断开。将单次请求拆成小批次(每批 8 个 seq),减小单帧体积。 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Browser WebSocket upgrades do not expose the HTTP error body, so WASM clients only saw NetworkError 10000 for token failures like 1507. Probe the handshake URL over HTTP and pass the real errCode to OnConnectFailed.
🅰 Please add the issue ID after "Fixes #"
Fixes #
H5 使用 @openim/wasm-client-sdk(底层为 openim-sdk-core 编译的 WASM)连接 msg_gateway 时,服务端因 token 无效返回 errCode: 1507 TokenNotExistError,但前端 OnConnectFailed 回调拿到的却是 errCode: 10000(NetworkError),导致业务无法按 token 类错误做退登,只能陷入「连接失败 → 重连」循环。
同一套服务端、同一 token,Flutter(原生 OpenIMCore)可以感知真实错误码;H5/WASM 侧错误码被吃掉。