frame
A self-contained unit of data in a protocol such as HTTP/2 or WebSocket, with a small header giving its type and length.
In more detail
Splitting traffic into frames lets a protocol interleave several messages on one connection and mix data with control messages such as ping or close. The receiver reads the header first to know how many bytes belong to the frame.
Related terms
- HTTP/2 — A version of HTTP that sends the same methods, statuses and headers in a binary format and runs many requests at once over one connection.
- WebSocket — A protocol that turns an HTTP connection into a long-lived, two-way channel where client and server can each send messages at any time.
- framing — The rule that marks where one message or record ends and the next begins in a stream of bytes.
- opcode — A small number in a frame header saying what kind of frame it is, such as text, binary, ping, pong or close.
Taught in
- Native HTTP/2 Protocols: Multiplexed Streams & Push — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services