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.