Afaik there is a better way to do that. For output, you have a php page that "never" stops loading and continuously sends new messages to the client. Turn of server side buffer, use flush() and make sure the browser can display the partially received data (e.g. do not use "unclosed" tables). Once the user aborts loading this page you'd know he quits the chat... - I tried this part and it works. For input, you display a form in a second frame. The script this form is submitted to now needs to communicate with the already running output scripts and tell them that there is a new message to be sent to each user - I think this should be possible with shared memory, but I never tried... Good luck!