I checked out with Firebug about what happens in the background, and I noticed, that chatbox causes quite a stress on browser, server and (total) bandwidth.
Here's few thoughts about how to make it less stressful:
* Fewer polling
. Seriously, once a second is quite heavy. I'd suggest once per 2-4 seconds, because after all, this is a website, not IM client.
If you want to play tricks, make a system that slowly drops polling frequency to something like once per 5-10s if there's no new messages in a period of time. And if there appears a new message, shoot the polling back to top freq.
* Use JSON.
Currently response to the chatbox-query returns content in HTML, which certainly is much more heavier than same content in JSON format.
* Don't return whole chatbox content when polling.
That's just pointless, we already have the content. This causes enormous usage of bandwidth for no good reason (5,4 KB/s at the moment). If there's no update, return as small response as possible and reasonable (if you want to keep things simpler, always return JSON).
* If possible, setup WebSocket
. This eliminates polling completely.
If you need "heads up", I can provide you couple useful links to php.net and some js-sources. I'm developing a sort of "series of minigames" for local library, where I utilize AJAX heavily, so it's quite "subject at hand".
Exception being WebSocket-subject - I know about it, but I haven't utilized it, mainly because my webhost does not provide it - thus I can't really help with that area.