2

I have a WCF Service Application that publishes information to various subscribers on different computers. The subscribers are in client applications which can dynamically subscribe and unsubscribe. When subscribing, I dispose of the subscription in the IDisposable.Dispose() method, so it should unsubscribe safely on disposal.

But what if the client application suddenly shuts down, and I am unable to properly dispose of the subscriber? Does that leave any references to the subscriber hanging on the publisher side? Or should I not worry about this at all?

EDIT:

Let me rephrase. Let's say you have a publisher/subscriber model via duplex messaging patterns on a WCF. How do you design it in such a way that the program is safe even when the client unexpectedly shuts down?

Anotherwords, how does the publisher know that the subscriber(client) is dead, so that it can unsubscribe the subscription?

user3685285
  • 6,066
  • 13
  • 54
  • 95
  • 1
    *I have a WCF Service Application that publishes information* - WCF does not support publish/subscribe natively, unless you're talking about callback contracts with the duplex bindings. Is this what you are talking about, or have you implemented a pubsub layer over WCF? – tom redfern Aug 27 '15 at 13:08
  • The "Dispose" method is intended solely to be used within a local application. If used correctly with try..catch..finally or with using, Dispose will get called. If you are trying to call Dispose on the remote client from within the WCF Service Application, then you are not understanding the purpose of IDisposable, as it is used solely as a cleanup method for local objects, not remote clients. Perhaps adding some of your code will help clarify the question. – Russ Aug 27 '15 at 14:02
  • Perhaps you should think about using SignalR instead of WCF. – Aron Aug 27 '15 at 16:51
  • I'm not building an ASP.NET website. I'm trying to build a service that collects data from a third party source and attempting to expose that real-time data to other developers that program in a variety of languages with a variety of purposes. – user3685285 Aug 27 '15 at 16:54
  • @user3685285 did I say anything about ASP.Net? Again, please think about using SignalR. – Aron Aug 27 '15 at 17:16
  • 1
    possible duplicate of [Handling dropped clients in a duplex binding WCF application](http://stackoverflow.com/questions/4572864/handling-dropped-clients-in-a-duplex-binding-wcf-application) – Pero P. Aug 27 '15 at 18:48

0 Answers0