How to track / calculate bandwidth usage on a NodeJS server?

So, in some free time I developed a nodejs / socketio application that broadcasts video, but I would like to know what statistics it works in, my activity monitor works for me and is currently with 2 users sending data streams to each other and the statistics are as follows:

%CPU: 6.0
Threads: 5
Real Memory: 59.6mb

How can I determine the total MB / GB of data sent to the server?

+5
source share
1 answer

My suggestion would be to add a counter to your application.

You should be able to add something like the following:

socket.on('message', function(message, callback) { myCounter += sizeof(message); })

sizeof . , . , JSON.

+2

All Articles