104

I've been looking at ways to implement gmail-like messaging inside a browser, and arrived at the Comet concept. However, I haven't been able to find a good .NET implementation that allows me to do this within IIS (our application is written in ASP.NET 2.0).

The solutions I found (or could think of, for that matter) require leaving a running thread per user - so that it could return a response to him once he gets a message. This doesn't scale at all, of course.

So my question is - do you know of an ASP.NET implementation for Comet that works in a different way? Is that even possible with IIS?

2
  • 12
    I guess the initial MS-blessed implementation is SignalR: hanselman.com/blog/… Commented Aug 30, 2011 at 20:25
  • Node.JS is now supported on Azure, soon IIS on 2003 will be supported. That means we will be able to run the comet server within IIS (windowsazure.com/en-us/develop/nodejs) Commented Jan 16, 2012 at 22:52

8 Answers 8

44

Comet is challenging to scale with IIS because of comet's persistent connectivity, but there is a team looking at Comet scenarios now. Also look at Aaron Lerch's blog as I believe he's done some early Comet work in ASP.NET.

Sign up to request clarification or add additional context in comments.

3 Comments

This is actually implemented; check out WebSync, per Anton's response below. (frozenmountain.com/websync)
Does anyone called reverse ajax? check this out: pokein.codeplex.com
MVC Async Controllers can help fight the IIS problems by offloading the waiting to non IIS worker threads, see this great post by Clay Lenhart. Also see Chat Server Example Project on BitBucket.
33

WebSync is a standards-compliant scalable Comet server that integrates directly into the IIS/.NET pipeline. It's also available on demand as a hosted service.

It officially supports up to 20,000 concurrent client connections per server node, but individual tests have seen it go as high as 50,000. Message throughput is optimal around the 1,000-5,000 concurrent clients mark, with messages delivered as high as 300,000 per second from a single node.

It includes client-side support for JavaScript, .NET/Mono, iOS, Mac OS X, Java, Silverlight, Windows Phone, Windows Runtime, and .NET Compact, with server-side support for .NET/Mono and PHP.

Clustering is supported using either SQL Server or Azure Caching out of the box, but custom providers can be written for just about anything (Redis, NCache).

Disclaimer: I work for the company that develops this product.

5 Comments

there should be a disclaimer here, as its your product ...
Sure, it's produced by the company I work for :) Definitely not trying to hide anything.
@Anton - not hiding something is not the same as disclosing it.
@Anton Can you elaborate more on how does it support up to 20k concurrent client connections per server node? These numbers look, well.. "too big".
I don't suppose it would be prudent to ask how websync works under the hood, conceptually - from a 25,000 foot view of course.
15

I recently wrote a simple example of a Long Polling Chat Server using MVC 3 Async Controllers based on a great article by Clay Lenhart

You can use the example on a AppHarbor deployment I set up based on the source from the BitBucket project.

Also, more information available from my blog post explaining the project.

2 Comments

i like the example on a AppHarbor deployment
'blog post explaining the project' --> web.archive.org/web/20130328042214/http://…
4

Actually there are many choices to create ajax supported website with ASP.NET but honestly, PokeIn is the easiest way to create an comet ajax supported web application. It has saved one of the projects of my company.

Comments

3

You might also look at the Kaazing Enterprise Gateway which has made a production release of their webSocket [HTML5] gateway which supersedes the comet way completely and enables full-duplex connections between browsers & application servers.

You might also look at Light Streamer Demos

Comments

1

I once used a chat site long ago that utilized a custom built http streaming server. I actually reproduced that software at one point out of sheer curiosity, and it's easy enough to do, I think. I would never try to implement a similar type of "infinite request" in IIS, especially in ASP.NET, because the requests tie up a thread pool thread (or IO thread, if asynchronous handlers are used) indefinitely, which means you can only handle so much per server as your thread pool configuration allows.

If I had a strong legitimate need for such functionality, I'd honestly write a custom http server for it.

I know that doesn't really answer your question, but I thought the input might be relevant.

Comments

1

The WS-I group published something called "Reliable Secure Profile" that has a Glass Fish and .NET implementation that apparently inter-operate well.

With any luck there is a Javascript implementation out there as well.

There is also a Silverlight implementation that uses HTTP Duplex. You can connect javascript to the Silverlight object to get callbacks when a push occurs.

There are also commercial paid versions as well.

2 Comments

Bulk-posting the exact same answer over a number of questions in short succession tends to trip a few flags...
0

I think the Comet approach isn't really scalable unless you are prepared to expand the web farm horizontally (by adding more web servers to the mix). The way it works is that it leaves a TCP connection open per user session, just so the server can push stuff into that connection from time to time to immediately inform the user of a change or activity.

1 Comment

Everything is only vertically scalable to a point, after which horizontal scaling has to take place.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.