First of all, if your connection to the server uses HTTP / 1.1, then you most likely already use "keep-alive".
What is it? Logically, HTTP is a connectionless protocol. This every request / response to the server creates a new connection, makes it a business and disconnects the connection. However, in HTTP / 1.1, the default behavior is to keep the connection open for subsequent server requests. The "keep-alive" header was added in HTTP / 1.0 to enable this behavior; in HTTP / 1.1, the server should refuse by closing the connection itself and / or sending the "close connection" header in response.
Why is it profitable? Creating a connection, especially for authentication, may take some time. By reusing an existing connection, configuration and authentication efforts are greatly reduced.
How can he improve your AJAX application? You probably already benefited from this.
What are the risks? When connecting through a shared device that can connect to the server on behalf of the client, other clients can reuse the connection, however, it also allows other clients to use the connection that the server has authenticated to another user.
AnthonyWJones
source share