• Post Reply Bookmark Topic Watch Topic
  • New Topic

Example web app for Server Sent Events (SSE) and Websockets  RSS feed

Saloon Keeper
Posts: 4423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now that JAX-RS 2.1 has been finalized, its reference implementation Jersey supports its new features, including Server Sent Events. To get folks going with that, here is a minimal web app that shows SEE in action. Drop it in your favorite servlet container's webapps directory, and it should become available automatically, probably at an URL like http://localhost:8080/websocket/. It's been tested with Tomcat 8.5 on Java 8 (which is the minimum Java version supported for JAX-RS 2.1).

The web app is based on this earlier one that demonstrated websockets, and also includes that part (hence its name).

One pitfall to avoid: the example in the documentation makes it seem as if the name of the message ("message-to-client") can contain hyphens - that does not work with current browsers. But that example code has in any case not been updated to the released version, so you're better off just using the source code that comes with this web app.
Filename: websocket.war
File size: 4 megabytes
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!