Silverlight HTML5 WebSocket client with an HTML bridge to Ajax/JavaScript

Hero Image

NOTE Answering to popular demand expressed in comments to this thread, we are now making a .NET prototype implementation of a WebSocket draft specification available for download. Check out the details at

One of the HTML 5 initiatives is to define a duplex communication protocol called WebSocket for use between web browsers and servers. The protocol enables a number of applications that must exchange messages between the client and the server with performance characteristics that cannot be met with the HTTP protocol. In particular, the protocol enables the server to send messages to the client at any time after the WebSocket connection has been established and without the HTTP protocol overhead. This contrasts WebSocket to technologies based on the HTTP long polling mechanism available today.
A sample web chat application built using a prototype implementation of the WebSocket protocol is available at, as well as hosted in Windows Azure at The prototype consists of the following components:

  1. The server side of the WebSocket protocol implemented using Windows Communication Foundation (WCF) from .NET Framework 4. The endpoint at ws:// implements two currently considered protocol proposals: the draft-ietf-hybi-thewebsocketprotocol-00 (also referred to as version 76), and draft-hixie-thewebsocketprotocol-75. The server implementation automatically detects the version the client is using.

  2. The client side of the WebSocket protocol implementation consists of two components:

  3. A Silverlight 4 application that implements the draft-hixie-thewebsocketprotocol-75 version of the WebSocket protocol. It is available at

  4. A jQuery extension that determines if the web browser in which the JavaScript application is running supports the WebSocket protocol natively or not. If the browser supports the WebSocket protocol natively, the jQuery extension gets out of the way. If the browser does not support the WebSocket protocol natively but does support Silverlight 4, the jQuery extension dynamically adds the Silverlight 4 application (#1) to the page and creates a set of JavaScript WebSocket APIs that delegate their functionality to the Silverlight application using the HTML bridge feature of Silverlight. It is available at

Given the approach taken, the sample chat application based on WebSockets should be working in all major browsers (Internet Explorer, Firefox, Chrome, Safari, Opera).

Mike Taulty has an excellent post explaining in more detail the client side implementation.


Most Recent

24 January 2022
Run Node.js from Google Sheets

Import data from any API or data source to Google Sheets using Node.js, NPM, and Fusebit Connectors.

21 January 2022
Linear and Discord Slash Commands

Learn how to build an interactive Slash Command for a Discord bot that lets users create a new issue in Linear.

19 January 2022
Add Slash Commands to Your Discord Bot!

Slash Commands are an extremely powerful way to provide rich interactivity for members of your Discord server, all you have to do is type “/” and you're ready to use your favorite bot.