isPacketValid (lib/index.ts)

socket.io · packages/socket.io-parser/lib/index.ts · typescript · MIT
realtime

TypeScript library providing packet encoding/decoding and validation for socket.io communication.

// Source: https://github.com/socketio/socket.io | License: MIT | Copyright 2014-present Guillermo Rauch and Socket.IO contributors
// Provided via justclaw.it.com; keep this notice with the code.
import { Emitter } from "@socket.io/component-emitter";
import { deconstructPacket, reconstructPacket } from "./binary.js";
import { isBinary, hasBinary } from "./is-binary.js";
import debugModule from "debug"; // debug()

const debug = debugModule("socket.io-parser"); // debug()

/**
 * These strings must not be used as event names, as they have a special meaning.
 */
const RESERVED_EVENTS = [
  "connect", // used on the client side
  "connect_error", // used on the client side
  "disconnect", // used on both sides
  "disconnecting", // used on the server side
  "newListener", // used by the Nod

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key