How to close a connection from javascript?
Hello,
I am running a chat service.
most of my members use mobile.
Even after they move away from my application, their connection is still active in ratchet.

I have the following javascript code.
Please tell me what code should I place in chatclose(); 


 window.onblur = timelyExit;  
 function timelyExit()
  {
        refInterval = 1;

        // change this to trigger some kind of inactivity timer
        setTimeout(function() { 

		chatclose(); 

		}, 10000);


  }


Also, is this the right method ?
Please suggest.
Thanks