I built my project using Struts, Spring, and Hibernate. I am using Tomcat for the server. Now I want to implement push notifications in my web application, to perform tasks like updating a table on a view layer according to new data in the database, or show a notification when a certain condition occurs. How can I implement this, and what tools should I use? Maybe Comet or something similar? If you have a link to a tutorial, I would find that helpful.
I am also wondering whether this (push) is related to messaging?
I've tried this link but it looks like pull. My case is like a chatting application - if someone logs in, the other member will get a notification. I am confused about how to implement this.
Have you tried the framework Atmosphere? It supports websocket and also fallback to mentioned longpolling.
It can be used with jquery on the client side. Tutorial is here.
Well the easiest way is use ajax calls with long polling(jQuery comes to mind). Comet is fine too.
Use Spring STOMP WebSockets.. its very easy and simple https://spring.io/guides/gs/messaging-stomp-websocket/
来源:https://stackoverflow.com/questions/13062048/push-notification-to-client