This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

Saloon Keeper
Posts: 4683
  • 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!