Pure sequence and gap detection helpers for ordered network streaming protocols. Reuse when implementing custom real-time messaging layers.
// Source: https://github.com/spinabot/brigade | License: MIT | Copyright 2026 Spinabot // Provided via justclaw.it.com; keep this notice with the code. /** * Pure sequence helpers for the reliable-streaming layer — shared by the * gateway (which STAMPS a per-session seq on every ordered `pi` frame) and the * client (which DETECTS a gap to trigger `resume`). Kept pure + dependency-free * so both sides agree by construction, and so the logic is unit-testable * without booting a socket (the suite convention). * * The contract in one line: only `pi` frames carry a per-session monotonic * `seq`; the client resumes whenever the next seq isn't the contiguous * successor of the last one it saw. */ /** * Next per-session sequence number for a session, or `undefined` when there is * no ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key