liveBook · Manning

Chunked transfer encoding

As explained in Build AI-Enhanced Web Apps

Chunked transfer encoding is an HTTP transfer method that sends a response as separately sized data chunks rather than as one predetermined-length body.

Chunked transfer encoding sends a response incrementally instead of waiting for one predetermined-length body. The server divides available data into chunks, allowing the client to process and display content as it arrives. section 3.2.1

A streaming response follows this sequence:

  • The client requests a streaming response. section 3.2.1
  • The server begins processing and sends available data without waiting for the complete response. section 3.2.1
  • Each chunk carries its size, its data, and a newline; the client reads chunks sequentially. section 3.2.1
  • A zero-length chunk marks the end, after which the client concludes the stream. section 3.2.1
1F\r\n
Hello, world! This is an ex
\r\n
1D\r\n
ample of chunked transfer encoding.
\r\n
0\r\n
\r\n

Inspect a wire-format example showing chunk sizes, separated payloads, and the terminating zero-length chunk. section 3.2.1

How Build AI-Enhanced Web Apps covers it

How deep it goes
Defines chunk framing and the streaming lifecycle, without tying the mechanism to implementation code or a specific framework.
Examples
Uses a response containing a greeting, split payload chunks, hexadecimal sizes, and a terminating zero chunk.
What you can do after
Understand how clients receive, process, and complete incrementally delivered responses.
How it connects
Connects HTTP streaming with client-server communication, incremental delivery, and keep-alive connections.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI-Enhanced Web Apps. The section links point to the parts of the book it draws on.