3

The WebSocket RFC states the following in the [Data Frame Section] (https://www.rfc-editor.org/rfc/rfc6455#section-5.2) when describing the Payload Length:

If 127, the following 8 bytes interpreted as a 64-bit unsigned integer (the most significant bit MUST be 0) are the payload length.

I have two questions:

  1. Is there a particular reason why the most significant bit must be 0?
  2. Does this makes the maximum size of a single frame 9223372036854775807 bytes?
Community
  • 1
  • 1
Kim Byer
  • 283
  • 1
  • 4
  • 12

1 Answers1

0
  1. The MSB holds the MASK-Bit. If this bit is set, the payload is masked with the following mask-key. The length-field is only 7 bits long.
  2. The maximum frame-size is correct
RalfW
  • 1
  • 1
  • I think you misunderstood something. The MASK bit comes before the length-field, and the length-field is either 7, 7+16, or 7+64 bits llong. I'm also wondering why the MSB of the 64 bits (in the 7+64 bit case) has to be zero. Maybe for future extensions? That still leaves you with 2**63-1 bytes though, which is 8388607 PiB of maximum payload length for a single frame. – Patrik Dec 06 '17 at 02:02
  • OK, I thought you meant the MSB of the Payload Length. You are right. – RalfW Mar 19 '18 at 17:49