views:

125

answers:

4

I am very wondering if there are any popular apis/frameworks currently available to do this? I am familiar with PHP and Javascript. So I am wondering how would one design a chat room? How does the server push the data to the individual connected clients?

I would like to build the server and the client side all on my own as a practice. So I would like to try to stay away from the IRC alternatives.

A: 

I would suggest IRC. It gives you a number of options in terms of drawing on existing software, such as web2irc AJAX IRC client and Unreal IRCd.

Kalium
A: 

If you are looking at an ajax chat client, then the client pulls from the server. Every few seconds the script running on the chat page makes a request of the server and pulls back any new text.

Here is a very simple one to look at it will give you an idea of what to do.

http://www.linuxuser.at/chat/index.html

I found it by googling ajax chat room

DC

DeveloperChris
I was thinking more of the push technology such as Comet, but I didn't find good tutorials on it.
ryanxu
comet chat is not push technology I just loaded one of their demo's and as far as I can tell its uses javascript to pull from the server every second or so. start up wireshark and you can watch the data flowing back and forth. what it does do is keeps the connection alive so it looks like its server push, but its not.
DeveloperChris
A: 

Simply get the mibbit client at http://wbe02.mibbit.com/manager/ and create yourself a channel in a irc server.

xav0989
+1  A: 

I personally really like XMPP (which is what Google Talk uses and is also known as Jabber). To do something really cool with javascript, check out the Comet project for an HTTP push framework. For javascript, dojo has an implementation of it that works quite well (just don't use the Google JS API version of dojo, it doesn't have a valid implementation of comet in there ;-) ). Additionally, there is an XMPP library for PHP that you can find here. Between dojo's cometd and the XMPP php library this shouldn't be too difficult to do. Also, if you don't need something as robust as XMPP, there actually is an example chatroom in the comet source (although the server is written in java, you can get the idea) found here.

Good luck!

Edit As per your comment below, a tutorial for Comet can be found here. Although it uses Java on the server, you can use the principals discussed at the PHP link above and just tweak this tutorial a bit.

Chris Thompson
thanks for the help
ryanxu
I was wondering what do you think of APE http://www.ape-project.org/APE is a full-featured OpenSource solution designed for Ajax Push. It includes a comet server and a Javascript Framework. APE allows to implement any kind of real-time data streaming to a web browser, without having to install anything on the client-side.
ryanxu
To be honest with you, I've never heard of it. That doesn't necessarily mean anything good or bad, just that I haven't come across it. Just by looking at the site it looks pretty intriguing although I could easily see it providing far more functionality than you may need.
Chris Thompson