Search code examples
c#wcfodatawcf-data-services

Odata Wcf data service .NET client event notification


I am trying to implementing event notification in client when some data has been changed at server side so that the client doesn't have to poll every time. Earlier I am using WCF service in this with duplex channel and callback contract its possible to notify client if something happen.

[ServiceContract(CallbackContract = typeof(ILatchingEvent))]

But I am not sure how it should be implemented in WCF data service? Has anyone tried this.

I have heard about Notification Hubs from Azure which do the push notification, but I don't know how to implement it without using it in .NET client.

Any help is deeply appreciated.!


Solution

  • Ok I am assuming you are using Desktop client and WCF data service. So what I think its not possible to get events from WCF data service (I am not sure though), but can't you combine WCF service and ODATA to reach your goal.

    Steps:

    1) Make WCF service duplex channel and callback on interface as you have mentioned in your question.

    2) Make another interface for Registering the events.

    3) Now event can be generated using WCF service if the client is registered.

    4) Now when event is fired on the client side, you can call your service operation on ODATA Data service.

    I hope this will help :) if you require help with code let me know.