Wednesday, April 27, 2011

Geochat for Silverlight


Geochat for Silverlight is a browser-to-browser geo-collaboration sample. Graphics drawn in browser’s map can be immediately pushed to all other browsers on the internet. The web application uses Microsoft’s implementation of Comet, a model using long lived HTTP requests to simulate server to client communication without the overhead of polling.

Geochat is implemented in two parts.

  1. Server-side
    A Windows Communication Foundation (WCF) duplex service is created to maintain a connection to Silverlight clients.  The geochat implementation acts as broker between Silverlight clients by forwarding messages to individual (or all) clients.
  2. Client-side
    The Silverlight client is using PollingDuplexHttpBinding to maintain a connection with the server using AJAX polling.  The polling occurs every five seconds.

Click here to experiment with a live sample. Complete source code for this app is available here.