Authored by 李奇

fixed:链接关闭修改

... ... @@ -200,6 +200,10 @@ function pageInit() {
connectFailCb: function () {
$('.connect-fail').fadeIn();
},
socketClosedCb: function () {
alert('链接已经断开了,请刷新后重试!');
}
}));
}
... ...
... ... @@ -7,9 +7,10 @@
var times,
param,
servers,
socket,
server,
servers,
options,
connectId,
conversationMessage;
... ... @@ -19,9 +20,10 @@ function _randomServer() {
/**
* socket初始化
* @param options
* @param opts
*/
function socketInit(options) {
function socketInit(opts) {
options = opts;
servers = options.servers;
server = _randomServer();
conversationMessage = options.conversationMessage;
... ... @@ -84,7 +86,7 @@ function sendMsg(msg) {
if (socket.readyState === WebSocket.OPEN) {
socket.send(JSON.stringify(msg));
} else {
console.log('The socket is not open.');
options.socketClosedCb();
}
}
... ...