Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Websocket Frames in Chrome

When inspecting Websocket frames via Chromes' debug console, is the length field measuring the payload in bytes? enter image description here

Obviously, it's the length of of the message. But, each character is one byte, right? If that is true, it's safe to say on my screenshot that 56, and 53 bytes were sent?

like image 439
NiCk Newman Avatar asked Sep 19 '26 00:09

NiCk Newman


1 Answers

Yes, the length reported in Chrome is the length of the payload in bytes.

There is some additional overhead in the message itself beyond just what the payload length reports (both webSocket frame overhead and TCP/IP overhead, though it is fairly efficient in overhead). You can see the webSocket frame format here .

In your screenshot, 53 and 56 bytes of message payload were sent, but something a little larger than that went over the actual wire. You could count the characters in the data it reports was sent and that length should match the reported length. Keep in mind that TCP is a reliable protocol so there is extra TCP/IP protocol related to the reliable delivery of any packet, including ACKS sent back to confirm delivery, unique packet numbers, etc..., but that extra data is relatively small.

like image 105
jfriend00 Avatar answered Sep 23 '26 07:09

jfriend00