/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { InteractionSettings } from "#action/InteractionSettings.js"; import { PeerAddress } from "#peer/PeerAddress.js"; import { ExchangeManager } from "#protocol/ExchangeManager.js"; import { MessageExchange } from "#protocol/MessageExchange.js"; import { SecureSession } from "#session/SecureSession.js"; import { ChannelType, Duration, ServerAddressUdp } from "@matter/general"; /** * Message exchange configuration options. */ export interface NewExchangeOptions extends Omit { /** * The protocol for the message exchange. * * Defaults to {@link INTERACTION_PROTOCOL_ID}. */ protocol?: number; /** * The name of the logical {@link PeerNetwork}. * * By default, matter.js selects a network based on the node's physical properties. Use "unlimited" to disable * rate limiting. */ network?: string; /** * Per-call override for the peer-medium MRP retransmission margin. When omitted the margin derives from the * peer's network medium, independent of any {@link network} throttle override. */ additionalMrpDelay?: Duration; /** * Optional address override for the exchange. When set, messages are sent to this address * instead of the session's default peer address. */ addressOverride?: ServerAddressUdp; /** * When true, requires an existing session and does not attempt to establish a new one. * The exchange creation fails if no active session is available. */ requireExistingSession?: boolean; /** Required transport type for this exchange. If set, only sessions of this transport type are used. */ requiredTransport?: ChannelType; /** * Per-call soft transport preference. Honored only when the peer advertises matching server * capability; otherwise the connect path falls back to UDP. Has no effect when * {@link requiredTransport} is set. */ preferredTransport?: ChannelType; } /** Why a reachability check was requested. Gates entry conditions, not the probe mechanics. */ export type ReachabilityReason = "address-change" | "session-suspect"; /** * Interface for obtaining a message exchange with a specific peer. */ export declare abstract class ExchangeProvider { protected readonly exchangeManager: ExchangeManager; constructor(exchangeManager: ExchangeManager); abstract maximumPeerResponseTime(expectedProcessingTime?: Duration, includeMaximumSendingTime?: boolean): Duration; abstract initiateExchange(options?: NewExchangeOptions): Promise; abstract readonly channelType: ChannelType; abstract readonly peerAddress?: PeerAddress; /** The peer's invoke path limit, or undefined where there is no peer to report one. Never below one. */ abstract readonly maxPathsPerInvoke?: number; /** * Peer-advertised CapabilityMinima path floors. Base values are the spec minimums. * @see {@link MatterSpecification.v161.Core} ยง 11.1.4.4 */ get readPathsSupported(): number; get subscribePathsSupported(): number; /** * Dedicated secure session backing this provider, if any. * * Providers that multiplex sessions (e.g. {@link PeerExchangeProvider}) return `undefined`. * Consumers can use this to react to session-lifecycle events without casting. */ get session(): SecureSession | undefined; /** * Ensure the peer is reachable without creating an exchange. * * The default implementation is a no-op (already connected). */ connect(_options?: NewExchangeOptions): Promise; /** * Verify the peer is reachable, driving recovery (alternate-address migration or session close). * * The default reports reachable; only peer-backed providers have a reachability authority and override this. */ verifyReachability(_options: { reason: ReachabilityReason; abort?: AbortSignal; }): Promise; } /** * Manages an exchange over an established channel. */ export declare class DedicatedChannelExchangeProvider extends ExchangeProvider { #private; constructor(exchangeManager: ExchangeManager, session: SecureSession); get maxPathsPerInvoke(): number; initiateExchange(options?: NewExchangeOptions): Promise; get channelType(): ChannelType; get session(): SecureSession; maximumPeerResponseTime(expectedProcessingTime?: Duration, includeMaximumSendingTime?: boolean): Duration; get peerAddress(): { fabricIndex: import("@matter/types").FabricIndex; nodeId: import("@matter/types").NodeId; } | undefined; } //# sourceMappingURL=ExchangeProvider.d.ts.map