Silverlight is an interesting RichUI for delivering applications over the web. Silverlight also has an option for socket communications starting from 4031 etc., for about 30 ports. So we also have the option of delivering live updates for silverlight over network sockets which would be very efficient live updates.
But currently we are restricting ourselves with a push option from IIS Comet architecture with one extended benefit. We need not be worried about opening the ports and just deliver the live updates over port 80 which saves a lot of support effort for many application owners.
The silverlight extension for flycomet implements the standard protocol of
- Invoke Connect to get the request id
- Subscribe to subscribe to a channel
- Keep polling for any updates fromm server
- Deliver any updates through a delegate LiveUpdateDelegate.
Using the FlyComet Silverlight extension:
Follow the steps to use flycomet in silverlight.
- Create a silverlight project
- Include Flycomet.dll from our main flycomet project
- Add the http handlers entry in web.config under system.web as follows
< httpHandlers >
< add verb=”*” path=”/FlyCometHandler.ashx” type=”FlyComet.FlyCometHandler” />
</ httpHandlers >
- Add the FlyCometSilverlight.dll into the silverlight project.
- Add the following code snippet.
FlyCometSilverlight fs = null;
fs = new FlyCometSilverlight(this);
fs.Connected += new FlyCometSilverlight.ConnectionDelegate(fs_Connected);
- The above will ensure we have connected to flycomet
- Use the following snippet to subscribe to a channel. Please remember we still do not support a full fledged nested channeling protocol.
- Receive all the live updaets by subscribing to liveupdate event.
fs.LiveUpdateReceived += new FlyCometSilverlight.LiveUpdateDelegate(fs_LiveDataReceived);
Now use FlyComet Publisher project to publish messages to the desired channel and we should be receiving data.