Skip to content
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

useWebSocket初始socketUrl为空报错,更新socketUrl导致无限重连 #2176

Closed
YinDongFang opened this issue Apr 26, 2023 · 1 comment · Fixed by #2177
Closed

useWebSocket初始socketUrl为空报错,更新socketUrl导致无限重连 #2176

YinDongFang opened this issue Apr 26, 2023 · 1 comment · Fixed by #2177

Comments

@YinDongFang
Copy link
Contributor

问题1:useWebSocket参数socketUrl初始值为空报错

image

复现地址:https://codesandbox.io/s/empty-initial-socketurl-z2uwvm?file=/App.tsx

预期:当初始socketUrl为空值时不执行connect

问题2:useWebSocket更新socketUrl导致无限重连

复现地址:https://codesandbox.io/s/update-socketurl-d1jjww?file=/App.tsx

复现步骤:等待连接成功后点击update

预期:更新socketUrl后重新建立连接并不会触发reconnect

@YinDongFang
Copy link
Contributor Author

相关issue:#1523

crazylxr pushed a commit that referenced this issue Jun 6, 2023
* fix: useWebSocket don't call connect when socketUrl is empty (#2176)

* fix: useWebSocket unlimited reconnect when update socketUrl (#2176)

* fix: disconnect not works

* docs: modify useWebSocket docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant