开发者

AJAX Instant messenger

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 real开发者_如何学运维ly 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 :)


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.


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.


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

I think it might get you going!


Use Stream Hub. Reverse AJAX - pretty cool stuff


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜