1 min read


In HTTP/1.1 (persistent connections or keep alive connections), the client can indicate that it wants to use a persistent connection by including the Connection: keep-alive header in its request. If the server supports persistent connections, it will respond with the same header to indicate that it will keep the connection open.

sequenceDiagram participant Client participant Server Note over Client,Server: Establish Connection Client->>Server: GET index.html Server->>Client: 200 OK Client->>Server: GET main.css Server->>Client: 200 OK Client->>Server: GET main.js Server->>Client: 200 OK Note over Client,Server: Close Connection

The persistent connection remains open until either the client or server explicitly closes it, or until a timeout occurs. The server can also choose to close the connection after a certain number of requests have been processed, or after a certain amount of time has elapsed, to prevent resource exhaustion.