MCPcopy Create free account
hub / github.com/ReactJSResources/react-webpack-babel / Manager

Function Manager

public/bundle.js:2636–2668  ·  view source on GitHub ↗

* `Manager` constructor. * * @param {String} engine instance or engine uri/opts * @param {Object} options * @api public

(uri, opts)

Source from the content-addressed store, hash-verified

2634 */
2635
2636 function Manager(uri, opts){
2637 if (!(this instanceof Manager)) return new Manager(uri, opts);
2638 if (uri && ('object' == typeof uri)) {
2639 opts = uri;
2640 uri = undefined;
2641 }
2642 opts = opts || {};
2643
2644 opts.path = opts.path || '/socket.io';
2645 this.nsps = {};
2646 this.subs = [];
2647 this.opts = opts;
2648 this.reconnection(opts.reconnection !== false);
2649 this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
2650 this.reconnectionDelay(opts.reconnectionDelay || 1000);
2651 this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
2652 this.randomizationFactor(opts.randomizationFactor || 0.5);
2653 this.backoff = new Backoff({
2654 min: this.reconnectionDelay(),
2655 max: this.reconnectionDelayMax(),
2656 jitter: this.randomizationFactor()
2657 });
2658 this.timeout(null == opts.timeout ? 20000 : opts.timeout);
2659 this.readyState = 'closed';
2660 this.uri = uri;
2661 this.connected = [];
2662 this.encoding = false;
2663 this.packetBuffer = [];
2664 this.encoder = new parser.Encoder();
2665 this.decoder = new parser.Decoder();
2666 this.autoConnect = opts.autoConnect !== false;
2667 if (this.autoConnect) this.open();
2668 }
2669
2670 /**
2671 * Propagate given event to sockets and emit on `this`

Callers 1

lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected