1

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

Rusty
  • 3,228
  • 19
  • 23
Roman
  • 171
  • 11

3 Answers3

0

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

Incognito
  • 16,567
  • 9
  • 52
  • 74
  • 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 Jun 03 '10 at 20:47
  • Using AJAX you'd still have to poll the server which is what he stated he wanted to avoid :( – Justin Jun 03 '10 at 20:49
  • AJAX is just Async JavaScript - it doesn't solve the problem. Still using polling... thanks though :) – Roman Jun 03 '10 at 20:55
0

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
  • 4,434
  • 4
  • 28
  • 37
  • thanks - looks like this can be a way... :) though most techniques of COMET still use polling. – Roman Jun 03 '10 at 20:57
0

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
  • 163,128
  • 34
  • 264
  • 314
  • 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 Jun 03 '10 at 21:08
  • 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 Jun 04 '10 at 00:14