Communication between all browsers opened for a particular web site from server side

一个人想着一个人 提交于 2019-12-24 07:14:07

问题


As shown in the image, if client1 sends some information to server, and on other side client2, client3, client4 also opened the same page to which client1 made changes, I want to show those changes to all users who are on that same page.

We can do the following:

  • Make call to server at some interval
  • Node.js

I am using Java, can this be done using sockets?

My idea is that client1's changes will be received by client2, client3, client4 by some kind of notification and only then will they call the server to get the desired changes.

How can this be achieved?


回答1:


take a look at akka -> akka provides the ability to build Asynchronous applications using Java. And yes you can make a very efficient solution for this using websockets+akka .

You can find an example of how to do this in Sample application (websocket-chat) for Play Framework which uses akka+websockets for making an asynchronous chat application.



来源:https://stackoverflow.com/questions/10563623/communication-between-all-browsers-opened-for-a-particular-web-site-from-server

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