I\'m creating a web application that would require small amounts of data (3 integer values per socket) to be sent from the server to the client very frequently and I wanted to s
How frequently can I send data using Socket.IO?
Is there a limit to how often I can send new data using Socket.IO?
There is no coded limit. It will only depend upon your ability to process the messages at both ends and the bandwidth to deliver them. If you really wanted to know your own limit with the hardware, network and OS you're running, you'd have to devise a test to send rapid fire packets of a representative size and see how many you can send in a second where they all get to the destination and no errors are seen on either end.
With the ideal number being 200 socket connections sending 50 updates per second.
Your server would need to be able to send 10,000 messages per second and each client would need to be able to process 50 incoming messages per second. That's all theoretically possible with the right hardware and right network connection.
But, 50 updates per second sounds like it's probably both unnecessary and inefficient. No end-user is going to perceive some change every 20ms which is what 50 updates per second comes down to. So, it would be a LOT more efficient to batch your updates to each client into maybe 10 updates per second.
I calculated that if each data packet being sent is approximately 500 bytes, then I would be able to send 20 updates a second to 100 connections on a 1 MB/s connection.
That type of calculation only works for sending large blocks of data. For lots of small messages, there are lots of inefficiencies as the TCP packet overhead and the webSocket/socket.io overhead for lots of small messages starts to become a measurable percentage of the overall bandwidth consumption and because TCP is a reliable protocol, there are also ACKs flowing back and forth to acknowledge delivery. If the packets are small, you probably don't have an overall bandwidth problem, the issue will be more with processing lots of small packets and the overhead to do that.
If you can combine updates into a smaller number of updates per second, you will get a lot better scalability.