|
Posted by Joseph Ferris on 10/20/32 11:58
jason.m.ho@gmail.com wrote:
> My question is, is an active HTTP connection possible? How did Meebo or
> Gmail implement their ajax chat? Can someone point me to a better tool
> for implementing an active-connection chat, rather than a poll-based
> one?
What you are looking for is "Reverse AJAX". In this case, the goal is
to raise events from the server to multiple clients. One way to do it
is to create a zero-sized frame and have a page that loads as slowly as
possible. You basically then would slap events into the streaming HTML
in the invisible frame, process the messages via JavaScript and send
them to an event handler that exists in the main frame. Polling is
another way, as you have done. Latency is the main downfall of that
approach.
One main caveat... Remember, that each client now has a connection
with your server that is continually loading a page. If you are ever
seeing a couple thousand users, at most, the networking layer on the
server should be able to handle it. Anything more than that, probably
not.
Here is some further reading:
http://ajaxpatterns.org/HTTP_Streaming
http://gmapsdotnetcontrol.blogspot.com/2006/08/exploring-reverse-ajax-ajax.html
And here is a resource on "slow loading" a page:
http://www.obviously.com/tech_tips/slow_load_technique
Good luck! ;-)
Joseph
Navigation:
[Reply to this message]
|