framing
The rule that marks where one message or record ends and the next begins in a stream of bytes.
In more detail
Content-Length frames a whole HTTP/1.1 body, newline-delimited JSON frames records by line, server-sent events frame events with a blank line, and HTTP/2 and WebSockets split data into binary frames. Without a framing rule, a receiver cannot tell a complete message from a partial one.
Related terms
- streaming — Sending a response in pieces as they become available instead of building the whole thing first.
- newline-delimited JSON — A streaming format in which every line is one complete JSON document, so each record can be parsed as soon as it arrives.
- 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.
- packet fragmentation — Data written as one message arriving split over several reads, or several messages arriving glued together in one read.
- Transform stream — A Duplex stream that changes data as it passes through, such as a compressor, a cipher or a packet parser.
- binary protocol — A network or file format that encodes messages as raw bytes at fixed positions instead of readable text.
Taught in
- What An API Is, And The Alternatives — Modern API Architecture: REST, GraphQL & gRPC
- Large Payloads And Streaming — Modern API Architecture: REST, GraphQL & gRPC
- Server-Sent Events — Modern API Architecture: REST, GraphQL & gRPC
- Transform Streams: Custom Packet Decoding & Codecs — Node.js Internals & Backend Services
- Native HTTP/2 Protocols: Multiplexed Streams & Push — Node.js Internals & Backend Services