title: How to implement a chat room using Jquery/PHP?
body: <p>I'm looking to implement a chat room using PHP/Javascript (Jquery) with both group chat and private chat features.</p>
  
  <p>The problem is how to continually update the interface in a natural way and possibly also how to show 'X is typing..' messages in private chat.</p>
  
  <p>The obvious way seems to be that every X seconds/milliseconds the javascript pings the server and fetches a list of new messages between the last ping and now. However, this can make the interface seem a bit unnatural, if suddenly the chat room is flooded with 5 messages. I would rather each message appear as it is typed.</p>
  
  <p>Is there a way for javascript to maintain a continuous connection to the server, the server pushes any new messages to this connection, and javascript adds them to the interface so they appear simultaneously, almost as soon as the server receives them?</p>
  
  <p>I know there are some polling options that require you to install some apache modules etc, but I'm pretty bad of a sysadmin, therefore I'd prefer if there was a very easy to install solution on a shared hosting account, or a php/mysql only solution.</p>