/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Message } from "#codec/MessageCodec.js"; import type { ExchangeLogContext, MessageExchange } from "#protocol/MessageExchange.js"; import type { Session } from "#session/Session.js"; import type { SessionParameters } from "#session/SessionParameters.js"; import { Bytes, Channel, ChannelType, Duration, MaybePromise, Observable, ServerAddressIp, ServerAddressUdp } from "@matter/general"; export declare class MessageChannel implements Channel { #private; readonly session: Session; closed: boolean; constructor(channel: Channel, session: Session, onClose?: () => MaybePromise); set onClose(callback: () => MaybePromise); /** Is the underlying transport reliable? */ get isReliable(): boolean; /** * Does the underlying transport support large messages? * This is only true for TCP channels currently. */ get supportsLargeMessages(): boolean; get type(): ChannelType; /** * Maximum size of an encoded Matter message sent on this channel. * * On TCP this is also capped at {@link Session.peerMaxTcpMessageSize}, because the peer closes the connection when * it receives a larger message. * * @see {@link MatterSpecification.v161.Core} ยง 4.15.2.3 */ get maxPayloadSize(): number; send(message: Message, options?: MessageChannelSendOptions): Promise; get name(): string; get networkAddress(): ServerAddressIp | undefined; set networkAddress(networkAddress: ServerAddressIp); get networkAddressChanged(): Observable<[ServerAddressIp], void>; /** The underlying transport channel, for identity comparison and type inspection. */ get transportChannel(): Channel; /** * Sync the addresses for IP network channels and replace channel if the IPs change * If the channel is on a non ip network then the call is basically ignored * We already use a new naming here which will be more used in future, so yes inconsistency in naming is ok for now * TODO refactor this out again and remove the address from the channel */ set socket(channel: Channel); close(): Promise; /** * Release the channel without closing the underlying transport channel, for use when the transport rather than the * session owns it. Closing a BLE channel disconnects the peripheral and closing a connected transport channel * drops messages of other sessions using it. */ release(): Promise; calculateMaximumPeerResponseTime(peerSessionParameters: SessionParameters, localSessionParameters: SessionParameters, expectedProcessingTime?: Duration, includeMaximumSendingTime?: boolean, localAdditionalDelay?: Duration, localFixedBackoff?: Duration): Duration; /** * Calculates the backoff time for a resubmission based on the current retransmission count. * If no session parameters are provided, the parameters of the current session are used. * If session parameters are provided, the method can be used to calculate the maximum backoff time for the other * side of the exchange. * * When `calculateMaximum` is set to true, we calculate the maximum time without any randomness. * * @see {@link MatterSpecification.v161.Core}, section 4.12.2.1 */ getMrpResubmissionBackOffTime(retransmissionCount: number, sessionParameters?: SessionParameters, calculateMaximum?: boolean, additionalDelay?: Duration, fixedBackoff?: Duration): Duration; } export interface MessageChannelSendOptions { /** The exchange initiating the send, used for diagnostics. */ exchange?: MessageExchange; /** Additional context for logging. */ logContext?: ExchangeLogContext; /** Override the destination address for this send without changing the channel's default address. */ addressOverride?: ServerAddressUdp; } //# sourceMappingURL=MessageChannel.d.ts.map