/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { MessageExchange } from "#protocol/MessageExchange.js"; import { Session } from "#session/Session.js"; export type SubscriptionId = number; /** * A single active subscription. */ export interface Subscription { subscriptionId: SubscriptionId; /** * Whether the subscription ended for good and the peer must establish a new one. Stays false after * {@link closeForShutdown}, so the node may re-establish the subscription when it starts again. */ isTerminated: boolean; handlePeerCancel(): Promise; /** * End the subscription for good. * * @param currentExchange the exchange whose send triggered this close; a subscription sending on it must not wait for itself */ close(flushViaSession?: Session, currentExchange?: MessageExchange): Promise; /** * Close the subscription because the node shuts down. Unlike {@link close} it does not terminate the * subscription, so the node may re-establish it on its next start. */ closeForShutdown(flushViaSession?: Session): Promise; } export declare namespace Subscription { function idStrOf(subscription: undefined | number | { subscriptionId?: number; }): string | undefined; function diagnosticOf(subscription: undefined | number | { subscriptionId?: number; }): { "sub#": string | undefined; }; } //# sourceMappingURL=Subscription.d.ts.map