aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Looking for a Pull Vs Push design solution for my application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Looking for a Pull Vs Push design solution for my application" Watch "Looking for a Pull Vs Push design solution for my application" New topic
Author

Looking for a Pull Vs Push design solution for my application

Ankush Sharma
Greenhorn

Joined: Sep 12, 2009
Posts: 3
Looking for a design solution where a logged in application user gets a notification once he receives a new email by highlighting a button so that he/she can check the the new messages received through the same application.
The objective is to alert the user for new emails till the time he is logged in to the application without refreshing the page.

I searched for many solutions in the net like pull vs push techniques.
One of the ways I can design this by making ajax calls on regular intervals by setting the time intervals.Its simple to implement this design using Ajax with Jquery.
The problem using this way the application will be making regular server calls without the server data actually changing and many calls will get wasted.There are options by specifying the delay time using the pull approach so that when
the response is not changing the time interval increases.
I even saw the long polling/comet approach wherein an ajax call is made and on the server we can check and return the response back only when the data in the server changes. This way the connections/request to the server can be minimized.I even checked the push approach options using websockets but it seems its not compatible with all browsers so discarded this approach.checked the DWR aswell but couldnt make out much.
Can experts out there let me know the best possible design like push/pull/long polling for this kind of scenario as the user needs to be notified whenever he receives a new email.
The frequency of receiving emails is not huge for a user.I am looking for a best design solution and approach to be used.Have couple of options but looking for the best approach.



Application Framework/Server of the application:

Application built on J2ee architecture deployed on Tomcat.

Regards
Java Techie

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Easiest solution is using a setTimeout and setting a new one when data comes back.

Most people who tried comet, normally ended up using polling.

Web Sockets are pretty new to JavaScript. It is not widely supported, but nice.

If you have the development time, you could use WebSockets if they are available with the client and fall bad to polling if not.

Eric
Ankush Sharma
Greenhorn

Joined: Sep 12, 2009
Posts: 3
Hi Eric,

Can you help me out in trying Web Sockets.Do you have a sample link showing an example for using this technique.

Regards
Ankush
 
wood burning stoves
 
subject: Looking for a Pull Vs Push design solution for my application