Push Notification to Client

南笙酒味 提交于 2019-12-19 11:31:03

问题


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.


回答1:


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.




回答2:


Well the easiest way is use ajax calls with long polling(jQuery comes to mind). Comet is fine too.




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!