Do not reconnect if process exited, fixes #50

This commit is contained in:
Shuanglei Tao
2017-05-20 18:55:48 +08:00
parent 9fc9ae063e
commit 4e0801db8e
3 changed files with 12 additions and 3 deletions

View File

@@ -93,7 +93,8 @@
}
window.removeEventListener('beforeunload', unloadCallback);
clearInterval(pingTimer);
if (autoReconnect > 0) {
// 1000: CLOSE_NORMAL
if (event.code !== 1000 && autoReconnect > 0) {
setTimeout(openWs, autoReconnect * 1000);
}
};