HTML and CSS Reference
In-Depth Information
message. Also, in early drafts of the protocol frames were messages, and the message
representation on the wire was called framing.
You'll recall from Chapter 2, that the WebSocket API does not expose frame-level
information to applications. It is possible to deal with sub-message data units at the
protocol level, even though the API works in terms of messages. There is typically only
one frame in a message, but a message can be composed of any number of frames.
Servers could use different numbers of frames to begin delivering data before the entirety
of the data is available.
Let's take a closer look at the aspects of the WebSocket frame. Figure 3-7 illustrates
the WebSocket frame header.
Figure 3-7. WebSocket frame header
WebSocket framing code is responsible for:
·
Opcodes
·
Length
·
Decoding Text
·
Masking
·
Multi-frame messages
Opcodes
Every WebSocket message has an opcode specifying the type of the message payload. The
opcode consists of the last four bits in the first byte of the frame header. Opcodes have a
numerical value, as described in Table 3-3 .
 
Search WWH ::




Custom Search