Is there a data limit that can be passed in Websocket.send?

Asked

Viewed 203 times

3

I built a server to implement the Websocket HTML5. In this implementation, I always send and receive data in the format JSON.

But I have the following question: There is a limit size to be passed in the method Websocket.send?

1 answer

8


A single Websocket frame, per RFC-6455 base frame, has a maximum size limit of 2 63 bytes (9,223,372,036,854,775,807 bytes ~ = 9,22 exabytes)

However, a Websocket message, composed of 1 or more frames, has no limit imposed from the protocol level.

Each Websocket implementation will treat message and frame boundaries differently. How to set maximum message sizes for the entire message (usually for memory consumption reasons) or offer streaming options for large messages to better utilize memory.

But in your case, it is likely that the chosen Websocket implementation has a bug and is improperly dividing the JSON message into multiple messages, rather than multiple frames. You can use the network inspection tool in Chrome or an external tool like Wireshark to confirm this behavior.

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.