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

Function decodePacket

client-dist/socket.io.js:382–406  ·  view source on GitHub ↗
(encodedPacket, binaryType)

Source from the content-addressed store, hash-verified

380
381 var withNativeArrayBuffer$1 = typeof ArrayBuffer === "function";
382 var decodePacket = function decodePacket(encodedPacket, binaryType) {
383 if (typeof encodedPacket !== "string") {
384 return {
385 type: "message",
386 data: mapBinary(encodedPacket, binaryType)
387 };
388 }
389 var type = encodedPacket.charAt(0);
390 if (type === "b") {
391 return {
392 type: "message",
393 data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
394 };
395 }
396 var packetType = PACKET_TYPES_REVERSE[type];
397 if (!packetType) {
398 return ERROR_PACKET;
399 }
400 return encodedPacket.length > 1 ? {
401 type: PACKET_TYPES_REVERSE[type],
402 data: encodedPacket.substring(1)
403 } : {
404 type: PACKET_TYPES_REVERSE[type]
405 };
406 };
407 var decodeBase64Packet = function decodeBase64Packet(data, binaryType) {
408 if (withNativeArrayBuffer$1) {
409 var decoded = decode$1(data);

Callers 3

decodePayloadFunction · 0.85
socket.io.jsFile · 0.85

Calls 2

mapBinaryFunction · 0.85
decodeBase64PacketFunction · 0.85

Tested by

no test coverage detected