Protocol hooks

Updated Nov 29, 2025

Install a custom protocol with with_protocol. protocol_hooks() converts the stored implementation into ProtocolHooks, which the connection actor consumes when draining responses and push queues.[^2][^7] WireframeProtocol exposes callbacks for connection setup, per-frame mutation, command completion, protocol errors, and optional end-of-stream frames. The connection actor invokes these hooks around every outbound frame and when response streams end or emit errors.[^14]