Reputation: 4302
As titled, is it possible?
My concept is using WCF with duplex channel, each client application will Login()
into the WCF and the WCF will stores the call back channel reference in the list (from GetCallbackChannel
).
Then when broadcasting it simply iterates through the callback channel list.
But... is it possible to stores a call back channel reference and shares in different service context then broadcast it?
I know it can be done with socket (I have no idea how lol), but I just really want know if is possible to do with WCF?
Upvotes: 3
Views: 3540
Reputation: 3308
Yes. You can basically set up a publish/subscribe situation if you wanted to using the Callbacks you obtained with OperationContext.Current.GetChannelCallbacks(). As for your InstanceContext=PerSessions concerns, you need to realize that you will have a different service instance for each session so your callback list has to exist outside the instance. You could make it static or singleton. Also you have thread safety issues to consider.
This is a good article that covers publish-subscribe: http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S6
Upvotes: 3
Reputation: 31780
It is certainly possible to implement broadcasting by iterating through a list of callback channels. I am not sure what you mean by "stores a call back channel reference and shares in different service context then broadcast it".
Upvotes: 1