Laharsub, a .NET Messaging Server
Laharsub is an open source .NET publish-subscribe message server for real time web applications like chat, online collaboration, news or stock trade updates, etc.
Laharsub is a publish-subscribe message server built on a 3-tier architecture: the front end - the client, a middle tier - a web service, and the back-end - a system with publish/subscribe functionality and storage capabilities. The client is typically a browser but can be anything knowing to make HTTP requests. The middle tier is a WCF HTTP service receiving and delivering messages from/to clients, and the back-end contains the actual message-related logic.
The clients can create topics and submit messages to them through a RESTful API, while other clients subscribe to multiple topics through HTTP long polling. One client can subscribe to multiple topics using one request. Laharsub provides jQuery, Silverlight and .NET 4.0 clients taking care of framing, multiplexing and long polling management. Laharsub will use WebSockets in the future according Tomasz Janczuk, the coordinator of the project.
The web service is stateless so it can scale-out well, according to Janczuk. Laharsub comes with an in-memory back-end scaling out to several thousands of users but limited to a single node. Those interested in better scalability have the option of “a custom backend that provides publish\subscribe functionality, message storage, and scale-out to multiple nodes in a web farm.” The web service runs as a Windows service or as a console application.
An example of subscribing to a topic is the following:
GET http://laharsrv/ps/sql/subscriptions/volatile?subs[topicid]=14&subs[from]=1 HTTP/1.1 Host: laharsrv
while the response could be
HTTP/1.1 200 OK Content-Length: 406 Content-Type: multipart/mixed; boundary=1d69db84.154e.47f7.be93.cc8b65b6efd0 Server: Microsoft-HTTPAPI/2.0 Date: Tue, 18 May 2010 23:14:24 GMT --1d69db84.154e.47f7.be93.cc8b65b6efd0 Content-Type: text/plain; charset=UTF-8 Content-Description: 14/929 Hello, world!
The project is hosted on CodePlex having a New BSD License (BSD). A page describing the some stress tests applied to the server and performance results was published here. Plans for the future include the ability to deploy the server on Windows Azure and Amazon EC2 including the capability to scale out to several machines.