socketio / socket.io

Realtime application framework (Node.JS server)
https://socket.io
MIT License
61.09k stars 10.11k forks source link

Can't enable debug messages when using client in a web worker #5104

Open rosejn opened 4 years ago

rosejn commented 4 years ago

You want to:

Current behavior

The documentation says to set localStorage.debug = '' in order to turn on debug messages, but when using socket.io-client from inside of a web worker we don't have access to localStorage. We tried explicitly calling debug.enable('') from the worker, but that doesn't seem to work either.

As doing more work in terms of I/O and processing (we are loading large datasets into the client) is moving to worker threads this is likely to become a more common issue. I'm not familiar enough with the setup to know whether this needs to be handled by socket-io.client or the debug library that it uses.

darrachequesne commented 4 years ago

Yes, I think it should be handled by the debug dependency directly. Please see https://github.com/visionmedia/debug/issues/589.