Implementing a server side push for a small number

2019-09-03 19:35发布

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?

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-03 19:43

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

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-09-03 20:01

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?

查看更多
登录 后发表回答