-
Notifications
You must be signed in to change notification settings - Fork 355
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 transport broken for dedicated worker scope #569
Comments
What's weird is that there's a test for that: https://github.com/socketio/engine.io-client/blob/3.1.0/test/connection.js#L63 Which seems to pass in saucelabs: Is there any error thrown? |
no errors thrown, but I cant enable debug from the worker scope (no localstorage) |
Looks like the test https://github.com/socketio/engine.io-client/blob/3.1.0/test/support/public/worker.js is just testing general connection functionality. If you start |
I haven't used |
So I wrote a test case for websocket transports, but edit: zuul probably related to this defunctzombie/zuul#314 |
Thanks for fixing the local tests. I've been able to reject my hypothesis. Things seem to be working fine as far as |
That may be linked to the |
Yes. Probably that. I had to pull debug out of my worker completely. |
Note: for support questions, please use one of these channels: stackoverflow or slack
You want to:
Current behaviour
WebSocket transport does not work in web worker.
Steps to reproduce (if the current behaviour is a bug)
Inside of a webworker, start socket.io with websocket transport only:
Expected behaviour
I expect to be able to connect to a websocket from a webworker.
Setup
[email protected]
is usingOther information (e.g. stacktraces, related issues, suggestions how to fix)
I believe these are the offending lines https://github.com/socketio/engine.io-client/blob/master/lib/transports/websocket.js#L11-L28
window
andglobal
are not defined inside of the dedicated worker scope.WebSocket
however is. Presuming a server environment from the lack of a window object is not safe for modern applications.I suggest something like the following:
I haven't tested this yet, but will probably be the next thing I do.
The text was updated successfully, but these errors were encountered: