Connection timeout (client side) VS Request timeout (server side)
Connection timeout is a common error that occurs whenever the client is waiting for too long before getting a response from any server (for API calls or browser requesting pages). This error is generated on the client side to terminate a connection, since we can only keep a limited number of open connections at the same time.
Normally, developers can determine how long “in seconds” they want to wait for a response before deciding to raise this error internally. And most HTTP clients allow us to specify:
On the other side, if you are the server rather than the client you might be more interested in the Request timeout.
Request timeout unlike connection timeouts in which a client is not willing to wait for response from server for too long. Server as well are not willing to keep unused connections alive for too long.
Once the connection has been established, the client must keep informing the server that it is still there by periodically sending information. If the client failed to so in a specified time, the server terminates this connection as it thinks that client is no longer there.
This behaviour is intended to avoid wasting resources. When time out occurs the server returns a Request Timeout
response with 408
status code.