You are here: Re: Ajax chat system - Active HTTP connection? « PHP Programming Language « IT news, forums, messages
Re: Ajax chat system - Active HTTP connection?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация