First of all, I am extremely exited to know that Ergo^ and Rob is
going to pick up where mcarter left off with hookbox. Hookbox is too
good to die...
If I had known about the performance issues I would probably think
twice about choosing hookbox, but I am not sure I would have been able
to find another comet server as flexible and easy to work with.
As Ergo^ once said to me, it is still possible to give users a good
experience despite the problems. I will describe my solution, and
maybe others will share there workarounds too...
I am running hookbox on FreeBSD, and using monit (
mmonit.org) to check
on hookbox every 10 seconds. This is my monit configuration:
---------------------------------------------
set daemon 10 with start delay 240
set logfile /var/log/monit.log
set mailserver localhost
set alert xx...@xxxxxx.xx
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server
and allow localhost
check process hookbox-prod with pidfile /var/log/hookbox/hookbox-
prod.pid
start program = "/usr/local/etc/rc.d/hookbox-prod.sh start" with
timeout 60 seconds
stop program = "/usr/local/etc/rc.d/hookbox-prod.sh stop"
if failed host 12.34.56.78 port 80 then restart #check comet server
if failed host 10.0.0.123 port 8095 then restart #check REST api
---------------------------------------------
If hookbox stops responding on any of the two interfaces, monit is
going to restart it within 10 seconds.
At the client side I have a loadChat() function to init the chat
(connect at subscribe to channels etc..). If the onClose() event is
fired
hbxConn.onClose = function() {
resetGlobals();
542 if (dojo.byId('preloader')) {
543 dojo.byId('preloader').style.display='block';
544 }
545 var rand_no = Math.floor((3000-1000)*Math.random()) + 1000;
546 var sec = Math.ceil(rand_no / 1000);
547 //console.log('Forbindelsen genoprettes om '+sec+' sekunder');
548 setTimeout('loadChat()',rand_no);
549 }