1

I'm trying to create a chat system using PHP and javascript. I want to know how the chat in Gmail works: it will remain in the same position even as the user moves to another page. I would be grateful if anyone could explain how it works.

And at the same time, please give some ideas on how to create a chat s/m. For example, the creation of the popup window, protocols to be used with chat, etc.

2 Answers 2

3

The chats in GMail, Facebook or Orkut stay at their same position even when you change pages thats because they are not doing a real page change when you click on any link inside GMail or Facebook or orkut. They load the page by means of a hash tag identifier and load the contents using standard AJAX. For example inside GMail you would find all links like inbox as https://mail.google.com/mail/?zx=xxxxxxx&shva=1#inbox and https://mail.google.com/mail/?zx=xxxxxxxx&shva=1#starred so when you click on them the browser doesn't actually reload a new page instead makes an AJAX request and pulls data in, hence this doesn't affect the chat block on the page.

You can have a look at http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=9#start for a simple PHP/MySQL based chat application. If you want a scalable chat application you have to go in Comet or "Bidirectional-streams Over Synchronous HTTP" BOSH. Friendfeeds TornadoWeb in python can help. http://www.tornadoweb.org/

Hope this info helps.

Sign up to request clarification or add additional context in comments.

3 Comments

thank you Geek, i know the things you said, but what my problem is i have a site ,and i need o add this chat to it. unfortunately its not done with ajax, thn how could i maintain this chat to be static, thats what am searching for :(
@raki, I don't think you can do that. If you reload the page, you lose the contents of the chat box (unless you persist it in some way). Both answers here go for AJAX and I think so too.
is it possible is am using iframes , ie both the contents can be added to two iframes and re configure the site :(
2

I understand that you want to create a "Chat system",

Gmail's chat is not an isolated system, it is closely integrated/Synced with Gtalk , (do you plan on providing a Desktop app as well as a web interface?)

Secondly Gtalk/Gmail chat uses a custom protocol(although it is open..meaning you can write your own Gtalk clients as well).

For your "Chat System", if you want it to be as nice as Gmail's you'll definitely need to use

AJAX and JSON along with Java Script and PHP

AJAX will help you to create Eye Catching at the same time responsive UI and and JSON will help you to transport data along the wire.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.