Framed packets as specified in the RFC:
http://tools.ietf.org/html/rfc6455#section-5
Overhead is up to 10 bytes per message or less than a fragment of the PER message. The number of bytes sent per fragment is determined by the length of the payload (part of the framing). However, fragments can be quite large. If you do not send very large messages, I do not think this will be a problem.
According to how framing and fragmentation works, you should not send / receive 1024 bytes of data if the framing data + is only about 100 bytes.
I suppose that some implementations may do this with slight differences, but you should not worry too much about such a detail if you do not start to see voltage problems in our application.
"Premature optimization is the root of all evil" Donald Knuth
Another detail: if you really want to go for a very low latency, you will have to start learning things like using UDP or multicast. The problem is that websockets does not support them. Reducing the size of packets is not the only important thing to work on the network, but only part of it ... and from my experience with socket.io, the processor becomes a bottleneck with small messages up to bandwidth, and RAM can also be severely damaged before bandwidth when messages are in low kilobytes. Of course, it depends entirely on your application, and I'm just talking about empirical experiences.
source share