Server-sent events

The classic model of HTTP communication is the single-request-response model: the client issues a request to the server, the server sends a response, the connection gets closed, that's all! Each HTTP connection serves exactly one response.

In some scenarios, the opposite of this model is required—the server sends some data to the client, without a special request from the client. This is very common in notification systems, such as social media notification pop-ups, or in applications such as chatting. When the client has a new notification or a chatting message, the server should redirect it to the client.

It is technically impossible for the server to initiate a connection to the client; therefore, some techniques were ...

Get Developing Middleware in Java EE 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.