পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Wednesday, February 8, 2017

Socket.IO - Logging and Debugging

Socket.IO uses a very famous debugging module developed by ExpresJS's main author, called debug.
Earlier socket.IO used to log everything to the console making it quite difficult to actually debug the problem. After the v1.0 release, you can specify what you want to log.

Server-side

The best way to see what information is available is to use the *:
DEBUG=* node app.js
This will colorize and output everything that happens to your server console. For example,

Client-side

Paste this to console, click enter and refresh your page. This will again output everything related to socket.io to your console.
localStorage.debug = '*';
You can limit the output to only get debug info with incoming data from socket using:
localStorage.debug = 'socket.io-client:socket';
You can see result like the following if you use the second statement to log the info:
There is a very good blog post related to socket.io debugging here.

No comments:

Post a Comment