Server-Sent Events (SSE) is a standard and part of HTML 5; it allows for one-way communication from the server to the client. So, a client can make one request and the server can keep sending multiple responses on the same connection. The client opens the connection with a server by passing the Accept header as text/event-stream. This connection is a long-running one between the client and server. The server can then publish events over the HTTP protocol. This allows for a better solution for pushing updates to clients than clients having to resort to inefficient means such as polling. JAXRS 2.1 has made API enhancements to support SSE. On the server-side, we can define a resource that produces text/event-stream, which clients can register with to receive events. Let's look at an example, where we combine CDI and JAXRS to push task updates to the interested...
Germany
Slovakia
Canada
Brazil
Singapore
Hungary
Philippines
Mexico
Thailand
Ukraine
Luxembourg
Estonia
Lithuania
Norway
Chile
United States
Great Britain
India
Spain
South Korea
Ecuador
Colombia
Taiwan
Switzerland
Indonesia
Cyprus
Denmark
Finland
Poland
Malta
Czechia
New Zealand
Austria
Turkey
France
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Malaysia
South Africa
Netherlands
Bulgaria
Latvia
Australia
Japan
Russia