SimoneF
SimoneF

Reputation: 432

C# - Design questions about a server firing push notifications to clients - how to implement?

This is the scenario.

I have multiple clients on our application, and one server. The server is itself disconnected from the clients, it just downloads some data from the web via a windows service (web services and FTP), processes the data and updates a database to which all the clients are connected and draw data from.

I would like to be able to actively notify the clients, and with a certain degree of granularity, when some downloading occurs (i.e. only the Traders when a price/trade update occurs, or only the Engineers when there's something for them) without polling.

The server should fire up a notification to all the connected clients instead of having them continuously "ask" if there is an update, because in this case I would have to maintain state on all the clients.

I thought about XMPP, with Matrix.

To do so each client has to open a persistent connection with the windows service, but I lack the exact details on how to implement this. MAybe with nodes! For what I understand XMPP is perfect for what I want to accomplish and gives me the extensibility to grow to some more functionality if I have the need to.

I don't know if to implement my own server or use one of the existing one (I hear jabberd2 has an excellent windows server).

But most important: I need suggestions on A) an XMPP server to run on Windows and B) a C# library. Besides Matrix I have found very few, and above all I need notifications support (pubsub).

Upvotes: 1

Views: 829

Answers (1)

Eric Farr
Eric Farr

Reputation: 2713

For simplicity, I'd consider using a WCF service that implements a long polling technique. This article gives some details on scaling the WCF service efficiently.

For notifications that there is new data in the database, if you are using SQL Server, try SqlDependency. It allows you to set up an event that fires in your code whenever the result of a given query changes. I've used it effectively for just this sort of thing.

Upvotes: 1

Related Questions