socket: Log the reason the SockJS connection was lost

(imported from commit 069067f9f979e7255f97f4943d6513076b2706bd)
This commit is contained in:
Zev Benjamin
2014-01-29 23:17:52 -05:00
committed by Steve Howell
parent b3a551f402
commit 1ed176b5ef

View File

@@ -247,14 +247,15 @@ Socket.prototype = {
}, 60000);
};
sockjs.onclose = function Socket__sockjs_onclose() {
sockjs.onclose = function Socket__sockjs_onclose(event) {
if (that._is_unloading) {
return;
}
// We've failed to handshake, but notify that the attempt finished
$(document).trigger($.Event('websocket_postopen.zulip', {}));
blueslip.info("SockJS connection lost. Attempting to reconnect soon.");
blueslip.info("SockJS connection lost. Attempting to reconnect soon."
+ " (" + event.code.toString() + ", " + event.reason + ")");
that._connection_failures++;
that._is_reconnecting = false;
that._try_to_reconnect(that._reconnect_wait_time());