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会一直开启关闭重启 #3936
Comments
15:00:53 [vite] hmr update /src/App.vue |
Describe the bug
使用的版本为: "@vueuse/core": "^10.9.0"
这是一段运行的代码
`
const state = reactive({
server: 'ws://124.222.224.186:8800',
retryTimeout: 3000,
sendValue: '',
recordList: [],
});
const { status, data, send, close, open } = useWebSocket(state.server, {
heartbeat: {
message: 'ping',
interval: state.retryTimeout
},
autoReconnect: true,
});
watchEffect(() => {
if (data.value) {
state.recordList.push(data.value);
console.log(state.recordList)
}
//会一直开启,关闭,重启
console.log(status.value)
});
如果这个ws无法连接请自行换个可以用的wss
`
由于Reproduction内无法使用ws链接,请自行更换wss链接即可复现
Reproduction
https://stackblitz.com/edit/vitejs-vite-ytf48z?file=package.json,src%2FApp.vue
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: