-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 in webworker:window in not defined #3937
Comments
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
in
work.js
,i useduseWebsocket
,the socket connect successfully,but when i want to use the websocketresponse data , an error message appears :
window in not defined
here is my
worker.js
import {useWebsocket} from @vueuse/core self.addEventlistener('message',(e) => { const {data} = useWebsocket(e.data.url,{ autoReconnect:{delay:3000}, onConnected:(ws) => { const sub = JSON.stringify({xxxx}) ws.send(sub) } }) // ----- error here : console.log(data) ---- })
Reproduction
none
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: