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

Method ondecoded

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

* Called when parser fully decodes a packet. * * @private

(packet: Packet)

Source from the content-addressed store, hash-verified

267 * @private
268 */
269 private ondecoded(packet: Packet): void {
270 const { namespace, authPayload } = this._parseNamespace(packet);
271 const socket = this.nsps.get(namespace);
272
273 if (!socket && packet.type === PacketType.CONNECT) {
274 this.connect(namespace, authPayload);
275 } else if (
276 socket &&
277 packet.type !== PacketType.CONNECT &&
278 packet.type !== PacketType.CONNECT_ERROR
279 ) {
280 process.nextTick(function () {
281 socket._onpacket(packet);
282 });
283 } else {
284 debug("invalid state (packet type: %s)", packet.type);
285 this.close();
286 }
287 }
288
289 private _parseNamespace(packet: Packet) {
290 if (this.conn.protocol !== 3) {

Callers

nothing calls this directly

Calls 5

_parseNamespaceMethod · 0.95
connectMethod · 0.95
closeMethod · 0.95
debugFunction · 0.85
_onpacketMethod · 0.80

Tested by

no test coverage detected