4

i made a chat application, here is the refresh code

   setInterval(function() {
      $('#DisplauDiv').load('show-chat.php?session=<?php echo $_GET['session'];?>');

   }, 1000);

And this keep loading in each second, that will slow down the perfomance of my Mysql. While i cheeked Facebook(firebug), they dont have anything like this to get response from server.

Please tell me the technique to do this.

Thanks in advance to all for reading and replaying this..

vish
  • 43
  • 1
  • 3

1 Answers1

1

well setInterval is poor man's comit have a look at COMET

also see this answer Reverse Ajax implementation using php

also see this link How are the facebook chat windows implemented?

open firebug will you are on the facebook page open the net panel in firebug and go to xhr you will notice a continuous spinning wheel that is COMET ...

Community
  • 1
  • 1
Rafay
  • 30,950
  • 5
  • 68
  • 101