Can I hook the Websocket constructor and onmessage
on the WebWorker (Dedicated Worker)?
If it is Main thread, you can hook it with JavaScript Proxy, but I would like to do this to Websocket on the WebWorker side.
The WebWorker's window
is a different object from the Main thread, so even if you use Proxy on the Main side, it will not be reflected on the WebWorker side.
What should I do?
javascript web-scraping websocket web-worker
You can execute code like globalThis.WebSocket=MyWebSocket;
on the target worker.
I think it's impossible if you can't modify the code that works with the worker.
© 2024 OneMinuteCode. All rights reserved.