Skip to content

Commit 42378f5

Browse files
committed
Update README.md
* 服务器主动close时 *
1 parent a976efe commit 42378f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ ws.onmessage = (evt) => {
115115
heartCheck.reset().start()
116116
};
117117

118+
ws.onclose = () => {
119+
if(logout){//如果前端主动关闭(如退出登陆),不做处理
120+
121+
}else {//如果服务器主动关闭,前端也需要重连时使用
122+
heartCheck.reset().start()
123+
}
124+
};
125+
118126
var heartCheck = {
119127
timeout: 10000,//default 10s
120128
timeoutObj: null,

0 commit comments

Comments
 (0)