Ok, on the server side there's a desktop application which is used to insert some information into a database (news,images,ect..) and i have clients which gather this information from database and store them into their local XML .
So each client downloads news from database and displays them .
The issue is how I can notify clients that there is an update .
My Solution
I thought using a database filed like UpdateID ,a开发者_如何学Pythonnd on each data update into database UpdateID should be Incremented +1, then every client should have an attribute UpdateID into their XML, and check if their UpdateID matches the Server UpdateID, if not than this is a new update. On each successful update, clients should place server UpdateID into their XML UpdateID .
So is there any better way to achieve that ?
PS : The Data Re-present layer which im using is a WCF Service
I think that the pull model that you propose is probably the easiest to implement and most straightforward solution to the problem. Knowing that you are using WCF webservices, however, you have the possibility to implement a push model using WCF Callbacks
. In this model you write service contracts just as normal but here the clients register themselves on the server. On data updates on the server the server calls a callback function on all registered clients, which respond by fetching new data.
The typical showcase application for this model is a ticketing system, where tickets are booked and released often. This approach eliminates the need for clients to constantly poll the server.
The article called Eliminate Server Polling with WCF Callbacks gives more details on the subject and also comes with a ticketing system example. This article also describes this method.
I am not saying that this is better than what you suggest yourself, but it may be worth looking into.
精彩评论