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

Method connect

packages/socket.io/lib/client.ts:118–146  ·  view source on GitHub ↗

* Connects a client to a namespace. * * @param {String} name - the namespace * @param {Object} auth - the auth parameters * @private

(name: string, auth: Record<string, unknown> = {})

Source from the content-addressed store, hash-verified

116 * @private
117 */
118 private connect(name: string, auth: Record<string, unknown> = {}): void {
119 if (this.server._nsps.has(name)) {
120 debug("connecting to namespace %s", name);
121 return this.doConnect(name, auth);
122 }
123
124 this.server._checkNamespace(
125 name,
126 auth,
127 (
128 dynamicNspName:
129 | Namespace<ListenEvents, EmitEvents, ServerSideEvents, SocketData>
130 | false,
131 ) => {
132 if (dynamicNspName) {
133 this.doConnect(name, auth);
134 } else {
135 debug("creation of namespace %s was denied", name);
136 this._packet({
137 type: PacketType.CONNECT_ERROR,
138 nsp: name,
139 data: {
140 message: "Invalid namespace",
141 },
142 });
143 }
144 },
145 );
146 }
147
148 /**
149 * Connects a client to a namespace.

Callers 7

ondecodedMethod · 0.95
onconnectionMethod · 0.95
socket.tsFile · 0.45
uws.tsFile · 0.45
server-close.tsFile · 0.45
initServerFunction · 0.45

Calls 4

doConnectMethod · 0.95
_packetMethod · 0.95
debugFunction · 0.85
_checkNamespaceMethod · 0.80

Tested by

no test coverage detected