MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / connect

Method connect

codebase/sources/dhtmlxscheduler.js:1165–1192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1163 return s && this.connect(), this;
1164 }
1165 connect() {
1166 const t2 = this._socket;
1167 t2 && (this._socket = null, t2.onclose = function() {
1168 }, t2.close()), this._mode = 2, this._socket = function(t3, e, s, i) {
1169 let n = e;
1170 "/" === n[0] && (n = document.location.protocol + "//" + document.location.host + e);
1171 n = n.replace(/^http(s|):/, "ws$1:");
1172 const o = -1 != n.indexOf("?") ? "&" : "?";
1173 n = `${n}${o}token=${s}&ws=1`;
1174 const r = new WebSocket(n);
1175 return r.onclose = () => setTimeout(() => t3.connect(), 2e3), r.onmessage = (e2) => {
1176 const s2 = JSON.parse(e2.data);
1177 switch (s2.action) {
1178 case "result":
1179 t3.result(s2.body, []);
1180 break;
1181 case "event":
1182 t3.fire(s2.body.name, s2.body.value);
1183 break;
1184 case "start":
1185 i();
1186 break;
1187 default:
1188 t3.onError(s2.data);
1189 }
1190 }, r;
1191 }(this, this._url, this._token, () => (this._mode = 3, this._send(), this._resubscribe(), this));
1192 }
1193 _wrapper(t2) {
1194 return (function() {
1195 const e = [].slice.call(arguments);

Callers 1

parseMethod · 0.95

Calls 7

_sendMethod · 0.95
_resubscribeMethod · 0.95
parseMethod · 0.65
iFunction · 0.50
resultMethod · 0.45
fireMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected