Best way to show LIVE notifications and messages on a web page?

I am interested in a really good way of instant messaging like meebo and facebook and myspace, and for notifications on the page. An example on my site now that a user receives a new email message, comment on a photo, profile comment, friend request, some other things, they will receive a notification and a link on the page on which they work using jQuery and AJAX.

I believe this is not the best way to do this, though, since my jquery code will basically run a PHP script to query the mysql table every 30 seconds or so for every user who has a page with this script run. I would like to, in the end, add some kind of instant messaging, for example facebook has in the chat panel at the bottom of the screen if I can find an effective way to do this.

I have heard the terms Comet and HTML5 WebSockets, but I'm not sure if these solutions are the ones over which I should look for such a function? I would like to keep bandwidth at a minimum, and running a request every few seconds seems not very efficient on a site with high traffic.

If you know some good solutions, explain how they work a little.

+5
source share
4 answers

I think Facebook uses XMPP for its chat, so take a look at it.

Xmpp

Open-source real-time data exchange technology that provides a wide range of applications, including instant messaging, presence, multi-user chat, voice and video calls, collaboration, lightweight middleware, content syndication and generalized XML data routing.

You have installed a separate server for processing messages, and in your application you would use a client with one of the available libraries .

+1

. PHP, SaaS, WebSync On-Demand, PHP , , . . .

+2

, ajax? , php script, memcached (, , db ).

, ...

+1

The main problem is that you need to implement a comet server (i.e. implement Server Push). Standard web hosts and apache do not allow you to do this easily. Another hosted solution (besides web synchronization) is the Goldfish server . Currently free.

0
source

All Articles