tags:

views:

94

answers:

3

Hey Guys,

I'm looking for a way to put real time features into my web site.

The idea is asynchronous communication between 2 people - like a chat session. If I use the chat example - I'd like the second person to know that the first one has sent a message to him, without refreshing or doing something active on the web page.

Polling is not a good idea here - so is there any other solution? the back-end could be ASP.NET or PHP (ASP.NET preferred).

Help would be much appreciated,

Thanks,

Roman

A: 

You can use AJAX... So there is no difference whether you choose ASP.NET or PHP.

Incognito
Could you be a bit less vague? Lately I see people referring to anything from JSONP requests to *drag and drop* as AJAX.
Matti Virkkunen
Using AJAX you'd still have to poll the server which is what he stated he wanted to avoid :(
Justin
AJAX is just Async JavaScript - it doesn't solve the problem. Still using polling... thanks though :)
Roman
A: 

You might want to check out COMET, as opposed to AJAX, for something like a chat system. This is what is used by FriendFeed and others to avoid lots of polling requests.

I found this blog and this article that talks about it with ASP.NET

Justin
thanks - looks like this can be a way... :) though most techniques of COMET still use polling.
Roman
A: 

Well, PHP isn't really suited to the task. But then again, neither is ASP.net. The reason for it is how the server (IIS/Apache) deals with the request. The application (and the connection) will need to stay alive until there's data to send. That's VERY expensive for single request per thread/process applications.

One option, is to use a stand alone server for the long poll COMET requests. Python has one that's already written: Tornado. You just run that program (and write the code to send the data to the client) as a web server (You can run it on a separate port or proxy to it, so that regular requests are handled by your primary web server).

ircmaxell
ohh, that's a really good point! Maybe you know of some solution using .NET? I don't really use python and would have to spend lots of time learning it.
Roman
Well, a quick google search turns up http://stackoverflow.com/questions/65673/comet-implementation-for-asp-net and http://www.codeproject.com/KB/aspnet/CometAsync.aspx
ircmaxell
There are open source sample ASP.NET projects : http://pokein.codeplex.com
Zuuum