Lesson 10.4

Backpressure to the wire, and the auto-drain

Wire the Readable's backpressure verdict to socket.pause / socket.resume so a slow consumer reduces incoming socket reads, and auto-drain an unconsumed body so pipelined requests survive.

34 minsrc/connection.js, examples/demo.js
  • Explain how a full Readable buffer reduces incoming socket reads through socket.pause.
  • Route incoming bytes to the body pump and resume the socket when the consumer pulls.
  • Auto-drain an unconsumed body before framing the next pipelined message.
Locked

This chapter is part of the framework capstone. Chapters 1 and 2 are free to build - unlock the rest to keep going.

Unlock the depth