Silverlight + WCF Duplex Polling

After reading a good article at Dimebrain called ‘Managing Social Data in Silverlight: do you push or pull’, it inspired me to work through the two articles on Silverlight/WCF Duplex Polling:

“How To Build a Duplex Service”:

This topic describes how to create a duplex Windows Communication Foundation (WCF) service that can communicate with a Silverlight client. A duplex service maintains a callback channel to the Silverlight client, which allows the service to make calls to the client at any given time. Duplex services have numerous applications including, for example, a chat server for instant messaging or a monitoring service that sends notifications to the client.

In duplex messaging, both service and client expose service contracts, which specify the operations that each of them exposes. In this example, we use the following pair of service contracts.

 

“How To Access a Duplex Service with the Channel Model”:

The procedure outlined here describes how to construct a Silverlight 2 client that sends an order to a duplex service and that is called back by that service twice, first when the service starts to process the order, and second when the order is completed.

Building a Silverlight duplex client involves a significant number of asynchronous calls, where callback methods are defined. The structure used for these asynchronous calls is standard. In the following procedure, some callbacks are omitted for clarity. The full source code, which contains all necessary methods, is available at the end of the procedure.

These two articles go hand in hand.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s