Using Server-Sent Events (SSE) with Nothing More Than Servlet
Join the DZone community and get the full member experience.Join For Free
As many of you know, HTML 5 Server-Sent Events (SSE) stands between the two extremes of completely stateless REST/HTTP and fully bidirectional WebSocket. It is a relatively simple mechanism that allows for sending data from the server to the client once a connection is established via plain HTTP. An interesting side-effect of this basic simplicity is you could conceivably use SSE with nothing more than the plain Servlet API. The downside of taking this approach is that you don't have the much higher level, easier to use specialized APIs for SSE such as the ones long included in Jersey (and now being proposed as part of Java EE 8).
Published at DZone with permission of Reza Rahman, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.