Skip to content

Instantly share code, notes, and snippets.

@deepanshumehtaa
Last active March 5, 2025 05:18
Show Gist options
  • Save deepanshumehtaa/8532d022720ec39fef04ec793bb66466 to your computer and use it in GitHub Desktop.
Save deepanshumehtaa/8532d022720ec39fef04ec793bb66466 to your computer and use it in GitHub Desktop.
SSE - Server-Sent Events
what is the time duration of SSE for keep-alive connection ?
The time duration of an SSE (Server-Sent Events) keep-alive connection can vary depending on several factors, including:
Server configuration: The server can specify a keep-alive timeout using the Keep-Alive header or other configuration settings.
Client configuration: The client can also specify a keep-alive timeout using the Keep-Alive header or other configuration settings.
Network conditions: Network conditions, such as latency and packet loss, can affect the keep-alive timeout.
Typically, the keep-alive timeout for SSE connections ranges from a few seconds to several minutes. Here are some common values:
Default timeout: 30 seconds to 1 minute
Typical timeout: 1-5 minutes
Maximum timeout: 30 minutes to 1 hour
When the keep-alive timeout is reached, the server will typically send a newline character (\n) or a comment line (:) to keep the connection alive. This is known as a "keep-alive ping."
If the client does not receive any data or keep-alive pings within the specified timeout, it will typically close the connection.
Note that the specific keep-alive timeout values may vary depending on the server and client implementations, as well as any custom configuration settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment