This can be done using web sockets.
A quick google search yields a php library called Ratchet
Web sockets essentially create a tunnel between the server and the client
so that the server can push/broadcast to all clients.
For example when a user types a message and sends it to the server, the
server could then broadcast it to all of the clients. This was you don't
I don't have experience with Ratchet but I do have experience with web
framework such as backbone.js