Commit e25b5126 authored by Alexander.Trofimov's avatar Alexander.Trofimov

refactoring code style function _initSocksJs

parent cabad702
......@@ -1533,7 +1533,7 @@
});
};
DocsCoApi.prototype._initSocksJs = function() {
DocsCoApi.prototype._initSocksJs = function () {
var t = this;
var sockjs;
......@@ -1544,10 +1544,11 @@
} else {
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
sockjs = this.sockjs = new (AscCommon.getSockJs())(this.sockjs_url, null, {'transports': ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
sockjs = this.sockjs = new (AscCommon.getSockJs())(this.sockjs_url, null,
{'transports': ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
}
sockjs.onopen = function() {
sockjs.onopen = function () {
if (t.reconnectTimeout) {
clearTimeout(t.reconnectTimeout);
t.reconnectTimeout = null;
......@@ -1557,7 +1558,7 @@
t._state = ConnectionState.WaitAuth;
t.onFirstConnect();
};
sockjs.onmessage = function(e) {
sockjs.onmessage = function (e) {
//TODO: add checks and error handling
//Get data type
var dataObject = JSON.parse(e.data);
......@@ -1629,7 +1630,7 @@
break;
}
};
sockjs.onclose = function(evt) {
sockjs.onclose = function (evt) {
if (ConnectionState.SaveChanges === t._state) {
// Мы сохраняли изменения и разорвалось соединение
t._isReSaveAfterAuth = true;
......@@ -1639,7 +1640,8 @@
}
}
t._state = ConnectionState.Reconnect;
var bIsDisconnectAtAll = ((c_oCloseCode.serverShutdown <= evt.code && evt.code <= c_oCloseCode.jwtError) || t.attemptCount >= t.maxAttemptCount);
var bIsDisconnectAtAll = ((c_oCloseCode.serverShutdown <= evt.code && evt.code <= c_oCloseCode.jwtError) ||
t.attemptCount >= t.maxAttemptCount);
var errorCode = null;
if (bIsDisconnectAtAll) {
t._state = ConnectionState.ClosedAll;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment