MCPcopy
hub / github.com/socketio/socket.io / Manager

Function Manager

packages/socket.io/client-dist/socket.io.js:4539–4572  ·  view source on GitHub ↗
(uri, opts)

Source from the content-addressed store, hash-verified

4537 var debug$1 = debugModule("socket.io-client:manager"); // debug()
4538 var Manager = /*#__PURE__*/function (_Emitter) {
4539 function Manager(uri, opts) {
4540 var _this;
4541 var _a;
4542 _this = _Emitter.call(this) || this;
4543 _this.nsps = {};
4544 _this.subs = [];
4545 if (uri && "object" === _typeof(uri)) {
4546 opts = uri;
4547 uri = undefined;
4548 }
4549 opts = opts || {};
4550 opts.path = opts.path || "/socket.io";
4551 _this.opts = opts;
4552 installTimerFunctions(_this, opts);
4553 _this.reconnection(opts.reconnection !== false);
4554 _this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
4555 _this.reconnectionDelay(opts.reconnectionDelay || 1000);
4556 _this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
4557 _this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
4558 _this.backoff = new Backoff({
4559 min: _this.reconnectionDelay(),
4560 max: _this.reconnectionDelayMax(),
4561 jitter: _this.randomizationFactor()
4562 });
4563 _this.timeout(null == opts.timeout ? 20000 : opts.timeout);
4564 _this._readyState = "closed";
4565 _this.uri = uri;
4566 var _parser = opts.parser || parser;
4567 _this.encoder = new _parser.Encoder();
4568 _this.decoder = new _parser.Decoder();
4569 _this._autoConnect = opts.autoConnect !== false;
4570 if (_this._autoConnect) _this.open();
4571 return _this;
4572 }
4573 _inheritsLoose(Manager, _Emitter);
4574 var _proto = Manager.prototype;
4575 _proto.reconnection = function reconnection(v) {

Callers

nothing calls this directly

Calls 9

_typeofFunction · 0.85
installTimerFunctionsFunction · 0.70
reconnectionMethod · 0.45
reconnectionAttemptsMethod · 0.45
reconnectionDelayMethod · 0.45
reconnectionDelayMaxMethod · 0.45
randomizationFactorMethod · 0.45
timeoutMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected