You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is some sample code creating a SharedWorker:
`
const myWorker = new SharedWorker('worker.js')
myWorker.port.start()
myWorker.port.onmessage = function (e) {
console.log('Message received from worker', e)
}
If I place the worker file (worker.js) on the same server as the html that contains the above code, then I see console logs for messages going to a from the worker.
However, if I host the worker locally with a resource override pointing at it, then creating the SharedWorker fails silently and the network tab shows the request as stalled with a status of (pending).
If I simply load the shared worker js file in a browser tab then Resource Override serves it fine, so it's not that RO is unable to serve the file to the browser. It just seems unable to serve the file for the purpose of being used as a Shared Worker.
I am using url -> url mapping with http-server -c-1 --cors. The requests are not shown in the http-server logs, so appear to be blocked in the browser.
Here is some sample code creating a SharedWorker:
`
const myWorker = new SharedWorker('worker.js')
myWorker.port.start()
myWorker.port.onmessage = function (e) {
console.log('Message received from worker', e)
}
window.setTimeout(() => {
console.log('Posting message to worker')
myWorker.port.postMessage('hello')
}, 3000)
`
If I place the worker file (worker.js) on the same server as the html that contains the above code, then I see console logs for messages going to a from the worker.
However, if I host the worker locally with a resource override pointing at it, then creating the SharedWorker fails silently and the network tab shows the request as stalled with a status of (pending).
If I simply load the shared worker js file in a browser tab then Resource Override serves it fine, so it's not that RO is unable to serve the file to the browser. It just seems unable to serve the file for the purpose of being used as a Shared Worker.
I am using url -> url mapping with
http-server -c-1 --cors
. The requests are not shown in the http-server logs, so appear to be blocked in the browser.Example code:
example.zip
The text was updated successfully, but these errors were encountered: