Authored by 陈轩

im fix

... ... @@ -137,7 +137,13 @@ var chat = {
self.handleReceiveMSG(received);
},
onOpen: $.noop,
onClose: $.noop
sendFailCallback: function() {
self._sysInfo('<p>连接断开,请尝试<span class="blue">重连</span></p>')
.one('click', function() {
self.connect();
});
},
};
let config = $.extend(socketConf, actions);
... ...
... ... @@ -9,6 +9,7 @@ var param,
servers,
socket,
server,
sendFailCallback,
conversationMessage;
function _randomServer() {
... ... @@ -40,6 +41,10 @@ function socketInit(options) {
socket.onclose = options.onClose || function() {
console.log('websocket is closed');
};
socket.onerror = options.onError || function() {
console.log('websocket meet error');
};
sendFailCallback = options.sendFailCallback || $.noop;
} else {
console.log('websocket is not support');
}
... ... @@ -57,6 +62,7 @@ function sendMsg(msg) {
console.log('websocket send: ', JSON.parse(msg));
socket.send(msg);
} else {
sendFailCallback();
console.log('The socket is not open.');
}
}
... ...