Visual RFC.
ALL RFCs / RFC 6455
Read the RFC ↗
RFC 6455 / PROTECT THE TRANSPORT

Closing the connection

06

Close frames coordinate shutdown before the underlying TCP connection is closed.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

DIAGRAM§ 7.1 ↗
RFC 6455 · § 7.1EXAMPLE
3 / 3
Closing the connectionClose 1000 travels to the peer, a Close response returns, and the lifelines terminate after the TCP shutdown.Close frames coordinate shutdownIllustrative normal closureClientServerClose 1000no more dataClose responseno more dataTCP connection closedBoth directions complete; shut down TCP
03
Release the underlying connection.

Both endpoints have sent and received Close; transport shutdown completes the connection lifecycle.

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
KEY POINT

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.
DETAILS

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.

Read the RFC section ↗

Diagrams simplify the RFC. Read the linked sections for complete requirements.

Privacy
All chapters in this RFC
  1. Opening handshake
  2. Messages in both directions
  3. Frame fields
  4. Fragments and control frames
  5. Client masking
  6. Closing the connection
RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗