I have an existing .net server infrastructure that resides in a company's intranet. Now for a new feature I'd like normal users (employees) to receive notifications on their machines when specific events occur on the server.
What's the best way to accomplish this? Polling periodically is a no-go for security reasons. But for a push method to work, we would need a constant connection to the server which gets complicated when there are too many users, disconnections and reconnections need to be handled, etc. Someone suggested to use a push message broker, which essentially is the "constant connection" approach but the "complicated" stuff is already handled by the broker.
Anyone has an idea how to go about this?
-
1Look up long polling.candied_orange– candied_orange05/14/2020 16:26:05Commented May 14, 2020 at 16:26
1 Answer 1
Pulling periodically is a no-go for security reasons.
Contrarily, I would argue that this "polling" is exactly the way you should go.
Your server has little, if any, idea about which clients are running at any point in time and would have to waste a sizeable part of its time maintaining connections to (or even just the information about) each of those clients.
Given that a company will almost certainly have Firewall restrictions in place, your server probably couldn't open a "connection" to any of these clients, even if it wanted to.
On the other hand ...
The client [program] knows when it is running, has to be able to open a "connection" to the server - otherwise it can't do anything at all - and can easily (and periodically) ask ...
"Has anything happened I need to know about?"
If the answer comes back "Yes", then the client can fire off a larger request to pull back the real Data payload.