-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Websocket is undefined #25
Comments
Hi, this isn't to do with Sockette. There's no WebSocket class in node.js, so you have to add one to the Not sure if I've answered elsewhere in these issues my recommendation. Eventually I'll include tests in this repo so that there's an example to follow, but no time now =\ Good luck! |
Thanks Lukeed, |
No problem~! You shouldn't modify any Instead, you should do this in your testing setup file, or at the top of test files (repetitive): // test/setup.js
global.WebSocket = require('ws'); |
it works! thanks again ^^ |
Hi @lukeed how are you?
Would you accept a PR to change the behavior so we can do something like this:
By default would be the window.WebSocket if is the browser and throw an error if you don't set a ws for nodejs |
Hey @tinchoz49 👋 No I would not, sorry. It would be meaningless to Sockette. You should simply do this instead: global.WebSocket = require('ws'); This would only be set in your Node.js environment, leaving The above will give you full support 👍 |
Don't worry 😃 I understand. Thanks for the quick response! |
Of course! Feel free to ping me if you have issues with setting that up~ |
Hi, i have a problem when testing my component using mocha & chai, it says:
i use mock-websocket. anyone know what did i miss?
The text was updated successfully, but these errors were encountered: