Shoutbox woes :(
Posted: Wed Apr 15, 2009 4:17 pm
Hi Everyone,
I recently coded a 'chatbox' for my site. I made it 'live' so that if someone posts a message, it shows up without you refreshing the page. To do this, I use: setInterval ( "myfunction()", 5000 ); to call an ajax function which checks if there are any new posts. The thing is, my webserver tells me that I have the max number of processes running (all calling this ajax function which checks if there are new posts). The ajax function is getting called every 5 seconds by tons of people even if there are no new posts... Can I make it so that the server updates all of the peoples browsers when someone someone posts a message, instead?
Thanks a lot!
Cheers,
Crispin
I recently coded a 'chatbox' for my site. I made it 'live' so that if someone posts a message, it shows up without you refreshing the page. To do this, I use: setInterval ( "myfunction()", 5000 ); to call an ajax function which checks if there are any new posts. The thing is, my webserver tells me that I have the max number of processes running (all calling this ajax function which checks if there are new posts). The ajax function is getting called every 5 seconds by tons of people even if there are no new posts... Can I make it so that the server updates all of the peoples browsers when someone someone posts a message, instead?
Thanks a lot!
Cheers,
Crispin