Michal Kowalkowski
Michal Kowalkowski

Reputation: 108

Is there a way to check size of the packet sent/received in Socket.io?

Just as in title. I am trying to check the size of the packets sent and received by Node.js server using Socket.io.

Upvotes: 2

Views: 1741

Answers (2)

Kurt Pattyn
Kurt Pattyn

Reputation: 2788

Depends on what you understand under 'packets'. If it is just the payload you are after, then ProblemFactory has the correct answer. Trying to get the size of the socket.io packages themselves, is not possible through the socket.io API.

Upvotes: 2

AbstractProblemFactory
AbstractProblemFactory

Reputation: 9811

JSON.stringify(response).length should do the trick.

Upvotes: 2

Related Questions