0

I am working on a rich client side Java EE application in which most of the processing takes place on the client side.

A typical scenario for this would be:

  • A user sends a request to the server to fetch results from a long running process.
  • The server performs a typical POST/REDIRECT async. and pushes the results to the clients as and when they are ready.
  • The client renders the response to the web page.

Is there a way we can use the server to push the messages directly to the clients to be notified (like the way gmail notification works)?

I know we can use JMS to publish the messages, but that would still require the client to make AJAX calls to the server to get the prepared message. Is there any other way I can achieve this?

tereško
  • 58,060
  • 25
  • 98
  • 150
tintin
  • 5,676
  • 15
  • 68
  • 97

1 Answers1

2

Have a look at Using Asynchronous Servlets for Web Push Notifications, a tutorial from Oracle (I have found the tutorial in this answer):

  • This requires AJAX on the client side, but the HTTP connection remains open.
  • The asynchronous job on the server side is receiving the JMS messages from the queue, and can send notifications to the browser.

If you can use other libraries, this question shows some ways to integrate JavaScript and JMS.

Related question: How do Facebook/gmail send real time notifications

Community
  • 1
  • 1
Beryllium
  • 12,808
  • 10
  • 56
  • 86