I am working on Java Web application using Light Streamer.
I am trying to track the LS disconnection on My Web Page with the following code.

engine.onStatusChange = function(chngStatus)
if (chngStatus == "DISCONNECTED") {
alert("Status : " + chngStatus);
window.location.reload();
}

if (chngStatus == "STALLED") {
alert("Status : " + chngStatus);
window.location.reload();
}
}
But this event is fired while closing LS as well as browser (Page). But I want to track LS disconnection on the above.

What i missed there? Or is there any other way to track the same.
Thanks in advance.