Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One way of simulating push notifications is <a href="http://en.wikipedia.org/wiki/Push_technology#Long_polling" rel="noreferrer">long polling</a>. This technique is called <a href="http://en.wikipedia.org/wiki/Reverse_Ajax" rel="noreferrer">Comet or Reverse AJAX</a>. While it's more common in REST based services, it can be just as easily accomplished in JAX-WS.</p> <p>For JAX-WS you will want to investigate:</p> <ul> <li><a href="http://today.java.net/pub/a/today/2006/09/19/asynchronous-jax-ws-web-services.html" rel="noreferrer">asynchronous web service invocation</a></li> <li><a href="http://www.ibm.com/developerworks/websphere/library/techarticles/0804_sedov/0804_sedov.html" rel="noreferrer">JAX-WS client APIs ... Using the JAX-WS asynchronous programming model</a></li> </ul> <blockquote> <p>Have the client call a webservice every 10 minutes to check if there are any new notifications</p> </blockquote> <p>Instead with long polling, you make the initial client connection right away. But instead of the server responding immediately, it hangs onto the connection (asynchronously). Then when a notification needs to be pushed, it responds back on the existing connection.</p> <p>With this technique, as soon as information is available on the server, it will be "pushed" to the client.</p> <blockquote> <p>For the database create a notification table and notifications seen. Link my users table to notifications seen table. Notifications seen is very basic with just 3 columns: NotificationID, UserID, TimeSeen.</p> </blockquote> <p>Sounds good. Expose it as a JAX-WS service. When the client receives the message, have them invoke it with the NotificationID.</p> <p>Something like:</p> <pre><code>NotificationService svc = ...; UserId userId = ...; AsyncHandler&lt;Notification&gt; handler = new AsyncHandler&lt;Notification&gt;() { public void handleResponse (Response&lt;Notification&gt; response) { Notification notification = response.get(); // update swing gui NotificationID notificationId = notifcation.getId(); svc.markNotificationAsSeen(userId, notificationId); // continue polling forever (or put in some logic to stop) svc.getNotificationAsync(userId, this); } }; Future&lt;?&gt; invocation = svc.getNotificationAsync(userId, handler); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload