Interface IMatrixClientCreateOpts

interface IMatrixClientCreateOpts {
    accessToken?: string;
    baseUrl: string;
    cryptoCallbacks?: ICryptoCallbacks;
    cryptoStore?: CryptoStore;
    deviceId?: string;
    deviceToImport?: IExportedDevice;
    fallbackICEServerAllowed?: boolean;
    fetchFn?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    forceTURN?: boolean;
    iceCandidatePoolSize?: number;
    idBaseUrl?: string;
    identityServer?: IIdentityServerProvider;
    isVoipWithNoMediaAllowed?: boolean;
    livekitServiceURL?: string;
    localTimeoutMs?: number;
    logger?: Logger;
    pickleKey?: string;
    queryParams?: Record<string, string>;
    refreshToken?: string;
    roomNameGenerator?: ((roomId, state) => null | string);
    scheduler?: MatrixScheduler<ISendEventResponse>;
    store?: IStore;
    supportsCallTransfer?: boolean;
    timelineSupport?: boolean;
    tokenRefreshFunction?: TokenRefreshFunction;
    useAuthorizationHeader?: boolean;
    useE2eForGroupCall?: boolean;
    useLivekitForGroupCalls?: boolean;
    userId?: string;
    usingExternalCrypto?: boolean;
    verificationMethods?: string[];
}

Hierarchy (view full)

Properties

accessToken?: string
baseUrl: string
cryptoCallbacks?: ICryptoCallbacks

Crypto callbacks provided by the application

cryptoStore?: CryptoStore

A store to be used for end-to-end crypto session data. If not specified, end-to-end crypto will be disabled. The createClient helper will create a default store if needed. Calls the factory supplied to setCryptoStoreFactory if unspecified; or if no factory has been specified, uses a default implementation (indexeddb in the browser, in-memory otherwise).

deviceId?: string

A unique identifier for this device; used for tracking things like crypto keys and access tokens. If not specified, end-to-end encryption will be disabled.

deviceToImport?: IExportedDevice

Device data exported with "exportDevice" method that must be imported to recreate this device. Should only be useful for devices with end-to-end crypto enabled. If provided, deviceId and userId should NOT be provided at the top level (they are present in the exported data).

fallbackICEServerAllowed?: boolean

Whether to allow a fallback ICE server should be used for negotiating a WebRTC connection if the homeserver doesn't provide any servers. Defaults to false.

fetchFn?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

The function to invoke for HTTP requests. Most supported environments have a global fetch registered to which this will fall back.

Type declaration

forceTURN?: boolean

Whether relaying calls through a TURN server should be forced. Default false.

iceCandidatePoolSize?: number

Up to this many ICE candidates will be gathered when an incoming call arrives. Gathering does not send data to the caller, but will communicate with the configured TURN server. Default 0.

idBaseUrl?: string
identityServer?: IIdentityServerProvider

Identity server provider to retrieve the user's access token when accessing the identity server. See also https://github.com/vector-im/element-web/issues/10615 which seeks to replace the previous approach of manual access tokens params with this callback throughout the SDK.

isVoipWithNoMediaAllowed?: boolean

If true, participant can join group call without video and audio this has to be allowed. By default, a local media stream is needed to establish a group call. Default: false.

livekitServiceURL?: string
localTimeoutMs?: number

The default maximum amount of time to wait before timing out HTTP requests. If not specified, there is no timeout.

logger?: Logger

A logger to associate with this MatrixClient. Defaults to the built-in global logger.

pickleKey?: string

Encryption key used for encrypting sensitive data (such as e2ee keys) in storage.

This must be set to the same value every time the client is initialised for the same device.

If unset, either a hardcoded key or no encryption at all is used, depending on the Crypto implementation.

No particular requirement is placed on the key data (it is fed into an HKDF to generate the actual encryption keys).

queryParams?: Record<string, string>

Extra query parameters to append to all requests with this client. Useful for application services which require ?user_id=.

refreshToken?: string
roomNameGenerator?: ((roomId, state) => null | string)

Method to generate room names for empty rooms and rooms names based on membership. Defaults to a built-in English handler with basic pluralisation.

Type declaration

    • (roomId, state): null | string
    • Parameters

      Returns null | string

The scheduler to use. If not specified, this client will not retry requests on failure. This client will supply its own processing function to MatrixScheduler#setProcessFunction.

store?: IStore

The data store used for sync data from the homeserver. If not specified, this client will not store any HTTP responses. The createClient helper will create a default store if needed.

supportsCallTransfer?: boolean

True to advertise support for call transfers to other parties on Matrix calls. Default false.

timelineSupport?: boolean

Set to true to enable improved timeline support, see MatrixClient#getEventTimeline. It is disabled by default for compatibility with older clients - in particular to maintain support for back-paginating the live timeline after a '/sync' result with a gap.

tokenRefreshFunction?: TokenRefreshFunction

Function used to attempt refreshing access and refresh tokens Called by http-api when a possibly expired token is encountered and a refreshToken is found

useAuthorizationHeader?: boolean

Set to true to use Authorization header instead of query param to send the access token to the server.

Default false.

useE2eForGroupCall?: boolean

If true, to-device signalling for group calls will be encrypted with Olm. Default: true.

useLivekitForGroupCalls?: boolean

If true, group calls will not establish media connectivity and only create the signaling events, so that livekit media can be used in the application layert (js-sdk contains no livekit code).

userId?: string
usingExternalCrypto?: boolean

Whether to allow sending messages to encrypted rooms when encryption is not available internally within this SDK. This is useful if you are using an external E2E proxy, for example. Defaults to false.

verificationMethods?: string[]

Verification methods we should offer to the other side when performing an interactive verification. If unset, we will offer all known methods. Currently these are: showing a QR code, scanning a QR code, and SAS (aka "emojis").

Generated using TypeDoc