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

10,494

Solution 1

It would not crash, I accidentally send a array of 250 extreme large objects over Socket.IO and it handled it without any issues.

You can just see it as sending a JSON object of 250 items over a http request, it could just take a while for the user to download it all.. Thats basically the only limitation you would be having.

Solution 2

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.

Share:
10,494

Related videos on Youtube

Philipp Kyeck
Author by

Philipp Kyeck

.

Updated on June 16, 2022

Comments

  • Philipp Kyeck
    Philipp Kyeck almost 2 years

    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?!