MCPcopy Index your code
hub / github.com/socketio/socket.io / setup

Method setup

lib/client.ts:88–108  ·  view source on GitHub ↗

* Sets up event listeners. * * @private

()

Source from the content-addressed store, hash-verified

86 * @private
87 */
88 private setup() {
89 this.onclose = this.onclose.bind(this);
90 this.ondata = this.ondata.bind(this);
91 this.onerror = this.onerror.bind(this);
92 this.ondecoded = this.ondecoded.bind(this);
93
94 // @ts-ignore
95 this.decoder.on("decoded", this.ondecoded);
96 this.conn.on("data", this.ondata);
97 this.conn.on("error", this.onerror);
98 this.conn.on("close", this.onclose);
99
100 this.connectTimeout = setTimeout(() => {
101 if (this.nsps.size === 0) {
102 debug("no namespace joined yet, close the client");
103 this.close();
104 } else {
105 debug("the client has already joined a namespace, nothing to do");
106 }
107 }, this.server._connectTimeout);
108 }
109
110 /**
111 * Connects a client to a namespace.

Callers 1

constructorMethod · 0.95

Calls 3

closeMethod · 0.95
bindMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected