Monday, July 26, 2010

Silverlight and .NET clients for the Laharsub publish/subscribe service for web clients

The just released 2010.07.25 stable build of the open source Laharsub project adds Silverlight 4 and .NET 4.0 clients. The current release contains:

  1. A Laharsub publish/subscribe server based on HTTP long polling protocol. The server is implemented using a .NET 4.0 WCF HTTP service and exposes REST APIs optimized for web clients.
  2. A .NET 4.0 client.
  3. A Silverlight 4 client.
  4. A jQuery AJAX-based JavaScript client.

I am looking forward to your comments and suggestions. You can read more about the open source Laharsub project at http://laharsub.codeplex.com.

Tuesday, July 20, 2010

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

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 http://tomasz.janczuk.org/2010/12/websockets-wcf-service-silverlight-and.html.

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 http://40interop.ep.interop.msftlabs.com/html5/wschat.html, as well as hosted in Windows Azure at http://websockets.cloudapp.net/wsdemo.html. 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://40interop.ep.interop.msftlabs.com:4502/servicemodelsamples/chat.svc 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:
    1. A Silverlight 4 application that implements the draft-hixie-thewebsocketprotocol-75 version of the WebSocket protocol. It is available at http://40interop.ep.interop.msftlabs.com/html5/ClientBin/Microsoft.ServiceModel.Websockets.xap.
    2. 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 http://40interop.ep.interop.msftlabs.com/html5/js/jquery.slws.js.

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.

Sunday, July 11, 2010

Laharsub: HTTP REST pub/sub service for AJAX and Silverlight web clients

Today I would like to announce the creation of the Laharsub project on Codeplex and invite you to download, use, review, comment, discuss, share ideas, and otherwise collaborate on this interesting technology.

Laharsub project on Codeplex

The objectives and scope of the Laharsub project are captured on the project’s site; to quote:

Overview
The growing trend of application development targeting web clients and open standards (HTML, JavaScript, HTML 5) generates demand for ever richer experiences for the web platform. Many interesting web applications require more than the traditional request/response communication pattern enabled by Ajax technologies. Web based chat or collaboration applications, multiplayer online gaming, or news or financial data dissemination applications require low latency, asynchronous data transfer from the server to the web client. Communication patterns in most of these applications are using a pub/sub model, with topics that multiple clients can publish to, subscribe to, and receive notifications from.

Goals
The goal of the Laharsub project is to provide a solution that makes it easy for web applications to organize internet scale message exchange using a publish/subscribe pattern. The project is an ongoing experiment with a variety of web technologies. Current focus is on AJAX (in particular jQuery) and Silverlight clients, a REST based HTTP long polling subscription protocol implemented by a .NET WCF HTTP middle tier service, and researching middle tier and back end technologies that enable scale-out to a large number of clients.

The project is directly related to my interest in rich communication patterns for web application. It draws on the lessons learned from the HTTP Polling Duplex protocol in Silverlight, and is an attempt to experiment with alternative approaches that may improve developer’s experience in a number of scenarios of data push to a web client. In particular:

  • It focuses on backend scalability,
  • It focuses on Ajax clients as much as on RIA (Silverlight) clients,
  • It focuses on the publish/subscribe message exchange pattern as opposed to duplex messaging capability, reflecting the majority use case for the HTTP Polling Duplex protocol in Silverlight.

I am looking forward to your feedback.

My Photo
My name is Tomasz Janczuk. I am currently working on my own venture - Mobile Chapters (http://mobilechapters.com). Formerly at Microsoft (12 years), focusing on node.js, JavaScript, Windows Azure, and .NET Framework.