Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js / socket.io is there a maximum message/event size

the titel says it all - is there a maximum size for an event (or message) i want to send from the server to the client?

i want to send a json string to the client and it looks something like this:

[{"id":"4e25434f0f110ec101000005","media":"4fb135d508e972664c5adf3.jpg"},
 {"id":"4e2545f30f110ec101000021","media":"d09b745414e251695aa33e04.jpg"},
 {"id":"4e2554ce7bcfb24702000012","media":"076eea872411e433b9.png"},
 {"id":"4e255bc4f34a41cb02000010","media":"c2af3db4707db3ece.png"}]

if the array would contain e.g. 200 items, would this crash?!

like image 644
Philipp Kyeck Avatar asked Jul 25 '11 14:07

Philipp Kyeck


People also ask

How much data can you send over a WebSocket?

The main reason for this large difference is that the browser limits the number of concurrent HTTP connections (6 by default in Chrome), while there is no limitation how many messages a websocket connection can send or receive.

How much traffic can Socket.IO handle?

Once you reboot your machine, you will now be able to happily go to 55k concurrent connections (per incoming IP).

Is Socket.IO scalable?

"The Socket.IO server currently has some problems with scaling up to more than 10K simultaneous client connections when using multiple processes and the Redis store, and the client has some issues that can cause it to open multiple connections to the same server, or not know that its connection has been severed."

Does Socket.IO use a lot of memory?

Socket.IO requires a lot of memory which is a potential problem. SockJS does not scale well at all and does not manage the same level of concurrency as the other two.


1 Answers

I dont think that will crash as node.js has an inbuilt nagle algorithm (if u havent disabled it) which buffers the data before sending it .

http://www.nodejs.org/docs/v0.5.1/api/net.html#socket.setNoDelay

Node.js alone can handle it easily for benchmarking purposes i have sent 800kb data in a chunk (random flush) . it took a lot of time to recieve on other side but was sent successfully.

like image 90
ShrekOverflow Avatar answered Oct 23 '22 14:10

ShrekOverflow