为少量客户端实现服务器端推送

发布于 2024-10-11 07:35:32 字数 270 浏览 4 评论 0原文

对于我正在开发的 Web 应用程序,我有以下要求:

  1. 客户端需要能够通过 Web 浏览器登录。
  2. 登录后,他们将能够
    • 更改配置(正常请求/响应)
    • 将能够接收服务器发送的警报(服务器端推送)

现在,问题是如何实现警报。我首先想到使用一些长轮询方法(Comet),但由于客户端数量肯定会限制在 5-10 个,所以我现在考虑采用更简单的方法。

我有哪些选择?让客户端轮询服务器可以吗?

For an web application I am working on I have the following requirements:

  1. Clients need to be able to log in via a web brower.
  2. After logging in, they will be able to
    • change configurations (normal request/response)
    • will be able to receive alarms sent by the server (a server side push)

Now, the question is how to implement the alarms. I first thought of using some long polling approach (Comet), but as the amount of clients will definitely belimited to 5-10, I'm now thinking to go with a simpler approach.

What are the options I have? Would it be okay to just let the clients poll the server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Saygoodbye 2024-10-18 07:35:32

5-10个客户?我会让他们轮询服务器。无需对此进行过度设计。

5-10 clients? I would just have them poll the server. No need to over engineer this.

夢归不見 2024-10-18 07:35:32

您可以考虑使用 Adob​​e Flash 对象打开到服务器的套接字连接。

这将允许客户端和服务器实际“连接”,从而让您在服务器上知道您确实已连接,或者连接何时丢失。

您还可以将一个简单的心跳系统与此结合起来,允许每秒或几秒钟进行“准备就绪”验证。

顺便说一句...您确定 Web 应用程序(而不是本机 GUI 应用程序)是适合此操作的平台吗?

You could consider using an Adobe Flash object to open a socket connection to the server.

This would allow the client and server to actually be "connected", therefore letting you know on the server that you are indeed connected, or when the connection is lost.

You could also tie in a simple heartbeat system into this, allowing "readiness" verification every second or few.

As a side note... Are you sure a web app is the right platform for this, as opposed to a native GUI application?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文