4

Can I have two different clients listening to the same WCF callback and have them both receive the same data without having to do the processing twice?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Xander
  • 9,069
  • 14
  • 70
  • 129

2 Answers2

6

Not really - at least not directly. What you're describing sounds a lot like the publish/subscribe pattern. A WCF service basically services one client and one client only, at any given time.

There are ways to do this in WCF 3.5 and better ones in WCF 4.0 - with or without Windows Azure's .NET Services. There are also other tools and support for the publish/subscribe pattern.

Check out things like:

If you Google or Bing for "WCF Publish Subscribe", you'll get a lot more hits - but those three should really get you started, I think.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • what if each client issues a request asking to be notified of the same event. Then, when the event occurs, the OP basically wants to do what .NET does when firing an event: call back each client with the event notification. – John Saunders Jun 30 '10 at 19:39
2

In addition to the links @marc_s posted, you can also check out Juval Lowy's Publish/Subscribe Framework, which is shown graphically below.

Publish-Subscribe Framework
(source: microsoft.com)
.

This framework is described in detail in this MSDN article. And you can download the framework's source code for free at Lowy's website, IDesign.net.

Using the Pub/Sub Service allows the Publisher to publish the event once to a well-known endpoint. The Pub/Sub Service then takes care of publishing the notification to the subscribed clients.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Matt Davis
  • 45,297
  • 16
  • 93
  • 124