Provides contextual information for Matter actions such as accessing attributes or invoking commands.

Matter.js provides an "online" ActionContext for you when responding to network requests. You can also use "offline" agents to invoke cluster APIs Endpoint without an active user session.

See OnlineContext and OfflineContext for details of these two types of interaction.

Context includes:

  • Authorization details such as AccessLevel, subject and accessing fabric

  • The transaction required to make state changes

  • Factory functions for Agent instances you can use to interact with Endpoints

  • When responding to network requests, low-level contextual information such as the wire message

For the formal definition of an "action" see MatterSpecification.v12.Core § 8.2.4

interface ActionContext {
    acceptInvalid?: boolean;
    activity?: Activity;
    command?: boolean;
    exchange?: MessageExchange;
    fabric?: FabricIndex;
    fabricFiltered?: boolean;
    interactionComplete?: AsyncObservable<[], void>;
    message?: Message;
    offline?: boolean;
    session?: SecureSession;
    subject?: NodeId;
    timed?: boolean;
    trace?: Action;
    transaction: Transaction;
    agentFor<const T>(endpoint: Endpoint<T>): Instance<T>;
    authorizedFor(desiredAccessLevel: AccessLevel, location?: Location): boolean;
}

Hierarchy (view full)

Properties

acceptInvalid?: boolean

If this is true, data validation is disabled. This should only be used in contexts where data validation is deferred.

activity?: Activity

Activity tracking information. If present, activity frames are inserted at key points for diagnostic purposes.

command?: boolean

If this is true then data access levels are not enforced. Datatypes and command-related access controls are active.

exchange?: MessageExchange

The Matter exchange in which an interaction occurs.

fabric?: FabricIndex

The fabric of the authorized client.

fabricFiltered?: boolean

If this is true, fabric-scoped lists are filtered to the accessing fabric.

interactionComplete?: AsyncObservable<[], void>

If present the session is associated with an online interaction. Emits when the interaction ends.

message?: Message

The wire message that initiated invocation.

offline?: boolean

If this is true then access levels are not enforced and all values are read/write. Datatypes are still enforced.

Tracks "offline" rather than "online" because this makes the safer mode (full enforcement) the default.

session?: SecureSession

The Matter session in which an interaction occurs.

subject?: NodeId

The authenticated SubjectId for online sessions.

timed?: boolean

If this is true a timed transaction is in effect.

trace?: Action

A target for instrumentation information. If present, various components will populate with diagnostic information during the action.

transaction: Transaction

The transaction used for isolating state changes associated with this session.

Methods