Wcf Duplex Contract – Subscriber-Publisher usng wsDualHttpBinding

Any real time Application (like score-card etc) that involves update are follow either of two process i.e Pulling or Pushing.

Pulling– client constantly sending request to server for updates. This implementation works fine when there are frequent updates but pulling can be an overhead when updates are very less.

Pushing– Server sends update to client when available. This is the best approach over pulling where we have very less updates from server.

wsDualHttpBinding is used Pushing implementation.
In .net netTcp & namedPipe binding support bi-directional binding but http not, so in WCF they introduced a new binding wsHttpBinding().
It has two channels, one is client to server & other is server to client.
Here we basically have two contracts,
->one contract which is used by service.
->other is used by Client which is a Callback contract.

[ServiceContract(CallbackContract = typeof(IMessageCallback))]
public interface IMessage
{
}

interface IMessageCallback
{
      [OperationContract(IsOneWay = true)]
      void OnMessageAdded(string message, DateTime timestamp);
}
Advertisements

Leave a comment

Filed under WCF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s