AJAX Instant messenger

4.3k views Asked by At

Hi I am trying to make an AJAX instant messenger. I currently have a website (with user logon, admin area etc.) using PHP, MySql, Java Script etc and an AJAX chat prog with 2 chat rooms (and users in room list etc) and it works really good, but dont really know where to go from here (instant messenger wise). I have done some researh which has suggested using an AJAX listener for new messages but I cant find much information on it...or if indeed this is needed or i should use something else. If anyone has any advice where I should go next it would be very, very much appreciated, thanks :)

6

There are 6 answers

0
Eamorr On

I'd suggest taking a look at www.socket.io for the real-time stuff.

There's even an instant messenger example on the site IIRC.

0
Trufa On

Why dont you go with something like AJAX Chat, it's free and open source!

I think it might get you going!

0
benhowdle89 On

Use Stream Hub. Reverse AJAX - pretty cool stuff

0
fifigyuri On

For a chat or chat-like application which needs realtime and immediate responses probably node.js is a way to go. The mentioned socket.io is also built on node.js. It can be used both on server and client side.

There are lot of blogs/tutorials about node.js. Or you may like this, even if it is for a little fee.

0
canhnm On

You can try cometd of Dojo Foundation! http://cometd.org/

0
Alfred On

Node.js

Like a lot of people mentioned I would use node.js/socket.io for this instead of PHP. It has been created to tackle such sort of problems.

Redis

But if you really want to create somethink like this in PHP I would do it using redis(needs to be installed). It has blocking list operations which really help you create something like this. When some user sents a message to another user we push the message to corresponding blocking list of that user. The user listens to an unique blocking list(key) to receive messages.

Can not install Redis

Then you have to use MySQL insert into a table and poll table frequently, but not to much to kill your server/database.