Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Like when you self-host the Socket.IO library, you can collect logs on both the server and client side when you use Web PubSub for Socket.IO.
The server side includes two utilities that provide debugging capabilities:
- DEBUG, which the Socket.IO library and extension library provided by Web PubSub use for certain logging.
- @azure/logger, which provides lower-level network-related logging. Conveniently, it also allows you to set a log level.
DEBUG=* node yourfile.js
# Logs debug information from the "socket.io" package
DEBUG=socket.io:* node yourfile.js
# Logs debug information from the "engine.io" package
DEBUG=engine:* node yourfile.js
# Logs debug information from the extension library "wps-sio-ext" provided by Web PubSub
DEBUG=wps-sio-ext:* node yourfile.js
# Logs debug information from multiple packages
DEBUG=engine:*,socket.io:*,wps-sio-ext:* node yourfile.js
You can enable logging from the @azure/logger
utility to get lower-level network-related information by setting the environmental variable AZURE_LOG_LEVEL
.
AZURE_LOG_LEVEL=verbose node yourfile.js
Azure_LOG_LEVEL
has four levels: verbose
, info
, warning
, and error
.
Using Web PubSub for Socket.IO doesn't change how you debug the Socket.IO library. Refer to the documentation from the Socket.IO library.
# Logs all debug information
DEBUG=* node yourfile.js
# Logs debug information from the "socket.io-client" package
DEBUG=socket.io-client:* node yourfile.js
# Logs debug information from the "engine.io-client" package
DEBUG=engine.io-client:* node yourfile.js
# Logs debug information from multiple packages
DEBUG=socket.io-client:*,engine.io-client* node yourfile.js
In a browser, use localStorage.debug = '<scope>'
.
# Logs all debug information
localStorage.debug = '*';
# Logs debug information from the "socket.io-client" package
localStorage.debug = 'socket.io-client';