从服务器端为特定网站打开的所有浏览器之间的通信 [英] Communication between all browsers opened for a particular web site from server side

查看:48
本文介绍了从服务器端为特定网站打开的所有浏览器之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如图所示,如果client1向服务器发送一些信息,并且在另一端client2,client3,client4也打开了client1对其进行更改的同一页面,我想向那些在该页面上的所有用户显示这些更改.同一页.

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:

  • 每隔一定时间拨打服务器电话
  • Node.js

我正在使用Java,可以使用套接字吗?

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

我的想法是client2,client3,client4会通过某种通知接收client1的更改,然后他们才调用服务器以获取所需的更改.

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.

如何实现?

推荐答案

看看akka-> akka提供了使用Java构建异步应用程序的功能.是的,您可以使用websockets + akka为此提供非常有效的解决方案.

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 .

您可以在适用于Play框架的示例应用程序(websocket-chat)中找到一个示例,该示例使用akka + websockets创建异步聊天应用程序.

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.

这篇关于从服务器端为特定网站打开的所有浏览器之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆