Implementing a server side push for a small number of clients

£可爱£侵袭症+ 提交于 2019-12-11 23:09:01

问题


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?


回答1:


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




回答2:


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?



来源:https://stackoverflow.com/questions/4642857/implementing-a-server-side-push-for-a-small-number-of-clients

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