Closing the connection
06Close frames coordinate shutdown before the underlying TCP connection is closed.
Both endpoints have sent and received Close; transport shutdown completes the connection lifecycle.
Key idea: Distinguish an orderly close from a broken connection.
Rules & examples
Distinguish an orderly close from a broken connection.
- After sending a Close frame, an endpoint must not send more data frames.
- An endpoint receiving Close sends a Close response if it has not already sent one; after both directions complete, close TCP.
- Close codes 1005 and 1006 are reserved for local reporting and must not appear in a transmitted Close frame.
A Close body, if present, starts with a two-byte status code and may include a UTF-8 reason. Invalid UTF-8 requires connection failure. After abnormal closure, randomized and increasing reconnect delays help avoid a retry storm.
Sources
New to this? Start hereA quick picture + helpful background
A request starts a conversation.
A client asks for a resource. A server sends a response. The method, address, headers, and status explain what that conversation means.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.