Back to the Catalog
websockets
networking
real-time

WebSocket Frames: Opcodes, Masking & Close Codes

11 questions

Below the handshake lies the WebSocket wire format (RFC 6455): the frame header, opcodes, mandatory client masking and why it exists, payload-length encoding, fragmentation, control frames, and close codes. The masking and length facts here are verified in Node.

Questions

  1. Not answered. A WebSocket frame's first byte is 0x81. What does that tell you?
  2. Not answered. Which opcode identifies a binary data frame? Give it as a decimal number.
  3. Not answered. Which statements about WebSocket frame masking are correct?
  4. Not answered. What problem does mandatory client→server masking actually solve?
  5. Not answered. A frame's 7-bit payload-length field holds the value 126. What does that mean?
  6. Not answered. Name the control frame (opcode 0x8) that initiates the WebSocket closing handshake.
  7. Not answered. Which rules apply to WebSocket control frames (Close, Ping, Pong)?
  8. Not answered. What WebSocket close status code signals a normal closure?
  9. Not answered. Your client logs WebSocket close code 1006, but the server insists it never sent it. Why?
  10. Not answered. A message is sent as several fragments. What opcode do the 2nd and later frames carry?
  11. Not answered. Must a text frame's payload be valid UTF-8, and what happens if it isn't?