• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Looking for a Pull Vs Push design solution for my application

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic