27.10.2015 Views

AJAX and PHP

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5<br />

<strong>AJAX</strong> Chat<br />

We are living in a world where communication has become very important; there's a real need to<br />

be able to communicate quickly <strong>and</strong> easily with others. Email, phone texting, postal letters, <strong>and</strong><br />

online chat offer media through which people can exchange ideas in the form of written words. An<br />

important aspect when communicating is the responsiveness factor. While emails <strong>and</strong> letters don't<br />

offer a live feedback from the other participants, phone <strong>and</strong> online chat offer a more dynamic way<br />

to communicate. In this chapter, we will build an <strong>AJAX</strong>-enabled online chat solution.<br />

Introducing <strong>AJAX</strong> Chat<br />

Most of the communication that takes place through the computer is done via desktop<br />

applications. These applications communicate with each other in a decentralized way using Peer<br />

to Peer (P2P) systems. However, these may not be viable options if you are inside a company<br />

whose security policy prevents users from opening connections on other ports than the HTTP port<br />

80. If that is the case, you are facing a real problem.<br />

There are numerous audio <strong>and</strong> video web chat solutions out there, most of them based on Java<br />

applets. Applets are known for their common security problems across browsers <strong>and</strong> sometimes<br />

they don't even use port 80 for communication. So, they are not a solution for getting in touch with<br />

your friends outside the company either.<br />

This is where <strong>AJAX</strong> comes into play <strong>and</strong> brings one answer for our problem. With a little effort<br />

one can even integrate into a browser an Internet Relay Chat (IRC) client or you can develop<br />

your own web chat solution such as the one you'll build later.<br />

Are you getting tired of being told that you cannot install or use your favorite messenger when you<br />

are at work, or when you are in an Internet Café? You might well have found yourself in such a<br />

situation before. This is the right time to see how we can break out of this unfortunate situation by<br />

using <strong>AJAX</strong> chat solution.<br />

<strong>AJAX</strong> Chat Solutions<br />

Probably the most impressive solution available today is www.meebo.com. We are pretty sure that<br />

some of you have heard about it, <strong>and</strong> if you haven't, it is time to have a look at it. The first <strong>and</strong> the<br />

most important feature is that it allows you to log in into your favorite instant messaging system<br />

by using only a web interface. See Meebo's login screen in Figure 5.1.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!