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.

RFC 6455 · § 7.1EXAMPLE
3 / 3
03
Release the underlying connection.

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

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

Key idea: Distinguish an orderly close from a broken connection.

Terms

Look up a term in the glossary ↗

Rules & examples
  • 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
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
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.

All chapters in RFC 6455

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

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

RFC status and corrections ↗