-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
v3.1.1: web workers are broken because importScripts() cannot load socket.io.js #3809
Comments
Thanks, I could indeed reproduce. That's weird though, the content type seems to be sent:
|
|
@darrachequesne The returned headers from v2 and v3 look more or less that same:
and (in agreement with your comment above) I believe the content is being transferred, so the problem must be in the content itself? |
I think I found the culprit: socketio/socket.io-client@8c08c5d Which causes "window is not defined" when used in a Worker. It works with |
@darrachequesne weird ... fyi, I do see a "window is not defined" error in Firefox if I load my v3.html worker test case (but not Chrome, where I generally do my debugging): |
A previous change ([1], included in 3.0.5) broke support for web workers, which threw "window is not defined" when importing the bundle in a web worker. Related: socketio/socket.io#3809 Reference: https://webpack.js.org/configuration/output/#outputglobalobject [1]: 8c08c5d
This should be fixed by socketio/socket.io-client@13b32b3, included in |
Thanks very much! |
A previous change ([1], included in 3.0.5) broke support for web workers, which threw "window is not defined" when importing the bundle in a web worker. Related: socketio/socket.io#3809 Reference: https://webpack.js.org/configuration/output/#outputglobalobject [1]: socketio/socket.io-client@8c08c5d
Describe the bug
Using v3.1.1 and calling importScripts() in a worker to load socket.io.js results in a NetworkError, such as the following:
Use of importScripts() works fine with v2.
To Reproduce
The attached zip file contains 4 files: v2.html, v2.js, along with v3.html, v3.js ... but they are short:
v2.html:
v2.js:
v3.html:
v3.js:
These two test cases use CDN files for the sake of simplicity. I am not using CDN files in my project, but get the same result.
To see the correct behavior (no error), load v2.html. To see the error in the JavaScript console, load v3.html.
According to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts, the Network error is indicates:
Expected behavior
I expect importScripts() to load socket.io.js successfully.
Platform:
socketioImportScripts.zip
The text was updated successfully, but these errors were encountered: