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

Method connect

codebase/dhtmlxscheduler.es.js:596–622  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594 return n && this.connect(), this;
595 }
596 connect() {
597 const i = this._socket;
598 i && (this._socket = null, i.onclose = function() {
599 }, i.close()), this._mode = 2, this._socket = function(t, n, s, a) {
600 let o = n;
601 o[0] === "/" && (o = document.location.protocol + "//" + document.location.host + n), o = o.replace(/^http(s|):/, "ws$1:");
602 const _ = o.indexOf("?") != -1 ? "&" : "?";
603 o = `${o}${_}token=${s}&ws=1`;
604 const r = new WebSocket(o);
605 return r.onclose = () => setTimeout(() => t.connect(), 2e3), r.onmessage = (d) => {
606 const l = JSON.parse(d.data);
607 switch (l.action) {
608 case "result":
609 t.result(l.body, []);
610 break;
611 case "event":
612 t.fire(l.body.name, l.body.value);
613 break;
614 case "start":
615 a();
616 break;
617 default:
618 t.onError(l.data);
619 }
620 }, r;
621 }(this, this._url, this._token, () => (this._mode = 3, this._send(), this._resubscribe(), this));
622 }
623 _wrapper(i) {
624 return (function() {
625 const t = [].slice.call(arguments);

Callers 1

parseMethod · 0.95

Calls 7

_sendMethod · 0.95
_resubscribeMethod · 0.95
aFunction · 0.70
parseMethod · 0.65
resultMethod · 0.45
fireMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected