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 开发者_如何学JAVAchat 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
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).
You can use AJAX... So there is no difference whether you choose ASP.NET or PHP.
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
精彩评论