/******************************************************************************** * Copyright (c) 2026 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the MIT License which is available in the project root. * * SPDX-License-Identifier: MIT ********************************************************************************/ /** The socket.io event that carries the highest message number a side has accepted. */ export declare const ACKNOWLEDGEMENT_EVENT = "hydranium:ack"; /** * What one side has received on a session: drops a message it already accepted * and acknowledges the rest. * * The peer resends everything unacknowledged when a session resumes, because it * cannot tell which of its messages died with the old socket, so every resumed * session can repeat messages already delivered. Delivering one twice corrupts * anything applied by position, just as losing one does. * * Acknowledges once enough has arrived, and otherwise after a short delay. A * timer alone is not enough: a background tab throttles timers, and the peer * holds every unacknowledged message until the acknowledgement arrives. The * first message of a session is acknowledged at once, because the peer resends * nothing until an acknowledgement shows it may. * * Belongs to one session. A new session numbers from the start again, so it * needs a new instance. */ export declare class InboundMessageSequence { protected readonly sendAcknowledgement: (sequence: number) => void; static readonly ACKNOWLEDGE_AFTER_MESSAGES = 64; static readonly ACKNOWLEDGE_AFTER_BYTES: number; static readonly ACKNOWLEDGE_DELAY_MS = 100; protected lastAccepted: number; protected messagesSinceAcknowledgement: number; protected bytesSinceAcknowledgement: number; protected acknowledgementTimer: ReturnType | undefined; constructor(sendAcknowledgement: (sequence: number) => void); /** * Whether to deliver a message that arrived with `sequence`. * * A message without a number comes from a peer that does not number them, * and is delivered as it is. A duplicate is still acknowledged: the peer * resent it because an earlier acknowledgement was lost, and keeps it until * one arrives. * * A skipped number is delivered past, with a warning: the skipped messages * are lost, and this is the one place that can tell. */ accept(sequence: unknown, bytes: number): boolean; /** Sends the acknowledgement now rather than waiting for more traffic. */ acknowledge(): void; dispose(): void; protected cancelTimer(): void; } //# sourceMappingURL=inbound-message-sequence.d.ts.map