Skip to content

Commit

Permalink
fix disconnect bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 22, 2015
1 parent abc76f9 commit 007e7fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
}
};
handlers.ws.onclose = function(evn) {
handlers.ws = null
handlers.isConnects=false
handlers.message="连接关闭!";
if(isFunction(callbackclose)===true) callbackclose(handlers,evn);
};
handlers.ws.onerror = function (evn) {
handlers.ws = null
handlers.isConnects=false
handlers.message="连接发生错误";
if(isFunction(callbackerror)===true) callbackerror(handlers,evn);
Expand Down Expand Up @@ -71,7 +73,6 @@
},
disconnect:function(ty,callback){//关闭连接的监听器
handlers.message="断开连接了!";

handlers.isConnects=false
if (handlers.ws !== null) return isFunction(callback)===true ? callback(handlers) :WS.close(ty);
}
Expand Down

0 comments on commit 007e7fe

Please sign in to comment.