Search code examples
websocketprotocolsspecifications

Websocket protocol continuation frame


I am trying to understand the websocket protocol https://www.rfc-editor.org/rfc/rfc6455

but do not understand what the continuation frame is. If I am making a websocket client, when would I expect a server to send this? When would I want to send it? The above reference has very little information about what the continuation frame is or does, or how a client (or a server) should handle it. From the protocol spec:

Opcode: 4 bits

  Defines the interpretation of the "Payload data".  If an unknown
  opcode is received, the receiving endpoint MUST _Fail the
  WebSocket Connection_.  The following values are defined.

  *  %x0 denotes a continuation frame

This is one of only three references to the continuation frame, and it is not giving me a lot to go on.

Should I just ignore any frames with this opcode?


Solution

  • No, you must not ignore continuation frames. If you don't implement them, your WebSocket implementation will not conform to RFC6455. Continuation frames are for fragmented WebSocket messages. All frames but the first are called continuation frames. All but the first and last are called non-final continuation frames.