Skip to content

RoomWidgetClient

Defined in: src/embedded.ts:152

A DigitalWorldClient that routes its requests through the widget API instead of the real CS API. This class is considered unstable!

new RoomWidgetClient(widgetApi, capabilities, roomId, opts, sendContentLoaded): RoomWidgetClient

Defined in: src/embedded.ts:172

WidgetApi

The widget api to use for communication.

ICapabilities

The capabilities the widget client will request.

string

The room id the widget is associated with.

IDigitalWorldClientCreateOpts

The configuration options for this client.

boolean

Whether to send a content loaded widget action immediately after initial setup. Set to false if the widget uses waitForIFrameLoad=true (in this case the client does not expect a content loaded action at all), or if the the widget wants to send the ContentLoaded action at a later point in time after the initial setup.

RoomWidgetClient

DigitalWorldClient.constructor

readonly _unstable_shouldApplyMessageRetention: boolean

Defined in: src/client.ts:1329

DigitalWorldClient._unstable_shouldApplyMessageRetention


baseUrl: string

Defined in: src/client.ts:1259

DigitalWorldClient.baseUrl


optional callEventHandler?: CallEventHandler

Defined in: src/client.ts:1253

DigitalWorldClient.callEventHandler


canSupport: Map<Feature, ServerSupport>

Defined in: src/client.ts:1290

DigitalWorldClient.canSupport


clientRunning: boolean = false

Defined in: src/client.ts:1225

DigitalWorldClient.clientRunning


credentials: object

Defined in: src/client.ts:1214

userId: string | null

DigitalWorldClient.credentials


cryptoCallbacks: CryptoCallbacks

Defined in: src/client.ts:1252

DigitalWorldClient.cryptoCallbacks


deviceId: string | null

Defined in: src/client.ts:1213

DigitalWorldClient.deviceId


readonly digitalWorldRTC: DigitalWorldRTCSessionManager

Defined in: src/client.ts:1324

DigitalWorldClient.digitalWorldRTC


disableVoip: boolean

Defined in: src/client.ts:1261

DigitalWorldClient.disableVoip


enableEncryptedStateEvents: boolean

Defined in: src/client.ts:1250

Support MSC4362: Simplified Encrypted State Events.

The client must be recreated for changes to this setting to take effect reliably.

When this setting is true, if we find a state event that is encrypted (within a room that supports encrypted state), we will attempt to decrypt it as specified in MSC4362. If the user was in the room at the time an encrypted state event was received (meaning we have the key), even if this setting was set to false at the time it was received, recreating the client with this setting set to true will allow decrypting that event.

When this setting is false, any state event that is encrypted will not be decrypted, meaning it will have no effect. This matched the behaviour of a client that does not support MSC4362.

DigitalWorldClient.enableEncryptedStateEvents


forceTURN: boolean = false

Defined in: src/client.ts:1256

DigitalWorldClient.forceTURN


optional groupCallEventHandler?: GroupCallEventHandler

Defined in: src/client.ts:1254

DigitalWorldClient.groupCallEventHandler


http: DigitalWorldHttpApi<IHttpOpts & object>

Defined in: src/client.ts:1229

DigitalWorldClient.http


iceCandidatePoolSize: number = 0

Defined in: src/client.ts:1257

DigitalWorldClient.iceCandidatePoolSize


optional idBaseUrl?: string

Defined in: src/client.ts:1258

DigitalWorldClient.idBaseUrl


optional identityServer?: IIdentityServerProvider

Defined in: src/client.ts:1228

DigitalWorldClient.identityServer


readonly ignoredInvites: IgnoredInvites

Defined in: src/client.ts:1322

DigitalWorldClient.ignoredInvites


readonly isVoipWithNoMediaAllowed: boolean

Defined in: src/client.ts:1260

DigitalWorldClient.isVoipWithNoMediaAllowed


optional livekitServiceURL?: string

Defined in: src/client.ts:1317

DigitalWorldClient.livekitServiceURL


olmVersion: [number, number, number] | null = null

Defined in: src/client.ts:1210

DigitalWorldClient.olmVersion


readonly pushProcessor: PushProcessor

Defined in: src/client.ts:1293

DigitalWorldClient.pushProcessor


optional pushRules?: IPushRules

Defined in: src/client.ts:1283

DigitalWorldClient.pushRules


reEmitter: TypedReEmitter<EmittedEvents, ClientEventHandlerMap>

Defined in: src/client.ts:1209

DigitalWorldClient.reEmitter


readonly retentionPolicyService: RetentionPolicyService

Defined in: src/client.ts:1327

DigitalWorldClient.retentionPolicyService


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

Defined in: src/client.ts:1282

string

RoomNameState

string | null

DigitalWorldClient.roomNameGenerator


optional scheduler?: DigitalWorldScheduler<ISendEventResponse>

Defined in: src/client.ts:1224

DigitalWorldClient.scheduler


supportsCallTransfer: boolean = false

Defined in: src/client.ts:1255

DigitalWorldClient.supportsCallTransfer


timelineSupport: boolean = false

Defined in: src/client.ts:1226

DigitalWorldClient.timelineSupport


urlPreviewCache: object = {}

Defined in: src/client.ts:1227

[key: string]: Promise<IPreviewUrlResponse>

DigitalWorldClient.urlPreviewCache


useLivekitForGroupCalls: boolean

Defined in: src/client.ts:1263

DigitalWorldClient.useLivekitForGroupCalls


usingExternalCrypto: boolean = false

Defined in: src/client.ts:1211

DigitalWorldClient.usingExternalCrypto


static captureRejections: boolean

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:425

Value: boolean

Change the default captureRejections option on all new EventEmitter objects.

v13.4.0, v12.16.0

DigitalWorldClient.captureRejections


readonly static captureRejectionSymbol: typeof captureRejectionSymbol

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:418

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

v13.4.0, v12.16.0

DigitalWorldClient.captureRejectionSymbol


static defaultMaxListeners: number

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:464

By default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual EventEmitter instances using the emitter.setMaxListeners(n) method. To change the default for allEventEmitter instances, the events.defaultMaxListeners property can be used. If this value is not a positive number, a RangeError is thrown.

Take caution when setting the events.defaultMaxListeners because the change affects all EventEmitter instances, including those created before the change is made. However, calling emitter.setMaxListeners(n) still has precedence over events.defaultMaxListeners.

This is not a hard limit. The EventEmitter instance will allow more listeners to be added but will output a trace warning to stderr indicating that a “possible EventEmitter memory leak” has been detected. For any single EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to temporarily avoid this warning:

import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});

The --trace-warnings command-line flag can be used to display the stack trace for such warnings.

The emitted warning can be inspected with process.on('warning') and will have the additional emitter, type, and count properties, referring to the event emitter instance, the event’s name and the number of attached listeners, respectively. Its name property is set to 'MaxListenersExceededWarning'.

v0.11.2

DigitalWorldClient.defaultMaxListeners


readonly static errorMonitor: typeof errorMonitor

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:411

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no regular 'error' listener is installed.

v13.6.0, v12.17.0

DigitalWorldClient.errorMonitor


readonly static RESTORE_BACKUP_ERROR_BAD_KEY: "RESTORE_BACKUP_ERROR_BAD_KEY" = "RESTORE_BACKUP_ERROR_BAD_KEY"

Defined in: src/client.ts:1205

DigitalWorldClient.RESTORE_BACKUP_ERROR_BAD_KEY

get pollingTurnServers(): boolean

Defined in: src/client.ts:5976

boolean

DigitalWorldClient.pollingTurnServers


get secretStorage(): ServerSideSecretStorage

Defined in: src/client.ts:2077

Access the server-side secret storage API for this client.

ServerSideSecretStorage

DigitalWorldClient.secretStorage


get store(): IStore

Defined in: src/client.ts:1454

IStore

set store(newStore): void

Defined in: src/client.ts:1449

IStore

void

DigitalWorldClient.store

_unstable_cancelScheduledDelayedEvent(delayId): Promise<EmptyObject>

Defined in: src/embedded.ts:548

This currently relies on an unstable MSC (MSC4140).

string

Promise<EmptyObject>

DigitalWorldClient._unstable_cancelScheduledDelayedEvent


_unstable_getDelayedEvents(status?, delayId?, fromToken?): Promise<DelayedEventInfo>

Defined in: src/client.ts:3633

Get information about delayed events owned by the requesting user.

Note: This endpoint is unstable, and can throw an Error. Check progress on MSC4140 for more details.

"scheduled" | "finalised"

string | string[]

string

Promise<DelayedEventInfo>

DigitalWorldClient._unstable_getDelayedEvents


_unstable_getRTCTransports(): Promise<Transport[]>

Defined in: src/client.ts:6204

Returns a set of configured RTC transports supported by the hub. Requires hub support for MSC4143.

Promise<Transport[]>

A M_NOT_FOUND error if not supported by the hub.

DigitalWorldClient._unstable_getRTCTransports


_unstable_getSharedRooms(userId): Promise<string[]>

Defined in: src/client.ts:6138

Gets a set of room IDs in common with another user.

Note: This endpoint is unstable, and can throw an Error. Check progress on MSC2666 for more details.

string

The userId to check.

Promise<string[]>

Promise which resolves to an array of rooms

DigitalWorldClient._unstable_getSharedRooms


_unstable_restartScheduledDelayedEvent(delayId): Promise<EmptyObject>

Defined in: src/embedded.ts:564

This currently relies on an unstable MSC (MSC4140).

string

Promise<EmptyObject>

DigitalWorldClient._unstable_restartScheduledDelayedEvent


_unstable_sendDelayedEvent<K>(roomId, delayOpts, threadId, eventType, content, txnId?): Promise<SendDelayedEventResponse>

Defined in: src/client.ts:3488

Send a delayed timeline event.

Note: This endpoint is unstable, and can throw an Error. Check progress on MSC4140 for more details.

K extends keyof TimelineEvents

string

SendDelayedEventRequestOpts

string | null

K

TimelineEvents[K]

string

Promise<SendDelayedEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient._unstable_sendDelayedEvent


_unstable_sendDelayedStateEvent<K>(roomId, delayOpts, eventType, content, stateKey?): Promise<SendDelayedEventResponse>

Defined in: src/embedded.ts:480

This currently relies on an unstable MSC (MSC4140).

K extends keyof StateEvents

string

SendDelayedEventRequestOpts

K

StateEvents[K]

string = ""

Promise<SendDelayedEventResponse>

DigitalWorldClient._unstable_sendDelayedStateEvent


_unstable_sendScheduledDelayedEvent(delayId): Promise<EmptyObject>

Defined in: src/embedded.ts:580

This currently relies on an unstable MSC (MSC4140).

string

Promise<EmptyObject>

DigitalWorldClient._unstable_sendScheduledDelayedEvent


_unstable_sendStickyDelayedEvent<K>(roomId, stickDuration, delayOpts, threadId, eventType, content, txnId?): Promise<SendDelayedEventResponse>

Defined in: src/client.ts:3523

Send a delayed sticky timeline event.

Note: This endpoint is unstable, and can throw an Error. Check progress on MSC4140 and MSC4354 for more details.

K extends keyof TimelineEvents

string

number

SendDelayedEventRequestOpts

string | null

K

TimelineEvents[K] & object

string

Promise<SendDelayedEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient._unstable_sendStickyDelayedEvent


_unstable_sendStickyEvent<K>(roomId, stickDuration, threadId, eventType, content, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3601

Send a sticky timeline event.

Note: This endpoint is unstable, and can throw an Error. Check progress on MSC4354 for more details.

K extends keyof TimelineEvents

string

number

string | null

K

TimelineEvents[K] & object

string

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient._unstable_sendStickyEvent


_unstable_updateDelayedEvent(delayId, action): Promise<EmptyObject>

Defined in: src/embedded.ts:522

This currently relies on an unstable MSC (MSC4140).

string

UpdateDelayedEventAction

Promise<EmptyObject>

DigitalWorldClient._unstable_updateDelayedEvent


optional [captureRejectionSymbol]<K>(error, event, …args): void

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:103

K

Error

string | symbol

AnyRest

void

DigitalWorldClient.[captureRejectionSymbol]


addListener<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:70

Alias for on.

T extends EventEmitterEvents | EmittedEvents

T

Listener<EmittedEvents, ClientEventHandlerMap, T>

this

DigitalWorldClient.addListener


addPushRule(scope, kind, ruleId, body): Promise<EmptyObject>

Defined in: src/client.ts:7826

string

PushRuleKind

string

Pick<IPushRule, "actions" | "conditions" | "pattern">

Promise<EmptyObject>

Promise which resolves: an empty object {}

DigitalWorldClient.addPushRule


addThreePidOnly(data): Promise<EmptyObject>

Defined in: src/client.ts:7573

Add a 3PID to your hub account. This API does not use an identity server, as the hub is expected to handle 3PID ownership validation.

IAddThreePidOnlyBody

A object with 3PID validation data from having called account/3pid/<medium>/requestToken on the hub.

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.addThreePidOnly


agreeToTerms(serviceType, baseUrl, accessToken, termsUrls): Promise<EmptyObject>

Defined in: src/client.ts:8555

SERVICE_TYPES

string

string

string[]

Promise<EmptyObject>

DigitalWorldClient.agreeToTerms


backPaginateRoomEventsSearch<T>(searchResults): Promise<T>

Defined in: src/client.ts:5696

Take a result from an earlier searchRoomEvents call, and backfill results.

T extends ISearchResults

T

the results object to be updated

Promise<T>

Promise which resolves: updated result object

DigitalWorldClient.backPaginateRoomEventsSearch


ban(roomId, userId, reason?): Promise<EmptyObject>

Defined in: src/client.ts:4233

string

string

string

Optional.

Promise<EmptyObject>

Promise which resolves: TODO

DigitalWorldClient.ban


bindThreePid(data): Promise<EmptyObject>

Defined in: src/client.ts:7589

Bind a 3PID for discovery onto an identity server via the hub. The identity server handles 3PID ownership validation and the hub records the new binding to track where all 3PIDs for the account are bound.

IBindThreePidBody

A object with 3PID validation data from having called validate/<medium>/requestToken on the identity server. It should also contain id_server and id_access_token fields as well.

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.bindThreePid


bulkLookupThreePids(query, identityAccessToken): Promise<{ threepids: [string, string, string][]; }>

Defined in: src/client.ts:8384

Looks up the public Digital World ID mappings for multiple 3PIDs.

[string, string][]

Array of arrays containing [medium, address]

string

The access_token field of the Identity Server /account/register response (see registerWithIdentityServer).

Promise<{ threepids: [string, string, string][]; }>

Promise which resolves: Lookup results from IS.

DigitalWorldClient.bulkLookupThreePids


cancelPendingEvent(event): void

Defined in: src/client.ts:2519

Cancel a queued or unsent event.

DigitalWorldEvent

Event to cancel

void

Error if the event is not in QUEUED, NOT_SENT or ENCRYPTING state

DigitalWorldClient.cancelPendingEvent


cancelUpload(upload): boolean

Defined in: src/client.ts:7322

Cancel a file upload in progress

Promise<UploadResponse>

The object returned from uploadContent

boolean

true if canceled, otherwise false

DigitalWorldClient.cancelUpload


checkTurnServers(): Promise<boolean>

Defined in: src/embedded.ts:667

Promise<boolean>

DigitalWorldClient.checkTurnServers


claimOneTimeKeys(devices, keyAlgorithm?, timeout?): Promise<IClaimOTKsResult>

Defined in: src/client.ts:7966

Claim one-time keys

[string, string][]

a list of [userId, deviceId] pairs

string = "signed_curve25519"

desired key type

number

the time (in milliseconds) to wait for keys from remote servers

Promise<IClaimOTKsResult>

Promise which resolves: result object. Rejects: with an error response (DigitalWorldError).

DigitalWorldClient.claimOneTimeKeys


clearStores(args?): Promise<void>

Defined in: src/client.ts:1600

Clear any data out of the persistent stores used by the client.

string

The database name to use for indexeddb, defaults to ‘digital-world-messaging-sdk’.

Promise<void>

Promise which resolves when the stores have been cleared.

DigitalWorldClient.clearStores


createAlias(alias, roomId): Promise<EmptyObject>

Defined in: src/client.ts:7205

Create an alias to room ID mapping.

string

The room alias to create.

string

The room ID to link the alias to.

Promise<EmptyObject>

Promise which resolves: an empty object {}

DigitalWorldClient.createAlias


createCall(roomId): DigitalWorldCall | null

Defined in: src/client.ts:1765

Creates a new call. The place*Call methods on the returned call can be used to actually place a call

string

The room the call is to be placed in.

DigitalWorldCall | null

the call or null if the browser doesn’t support calling.

DigitalWorldClient.createCall


createFilter(content): Promise<Filter>

Defined in: src/client.ts:5800

Create a new filter.

IFilterDefinition

The HTTP body for the request

Promise<Filter>

Promise which resolves to a Filter object.

DigitalWorldClient.createFilter


createGroupCall(roomId, type, isPtt, intent, dataChannelsEnabled?, dataChannelOptions?): Promise<GroupCall>

Defined in: src/client.ts:1775

Creates a new group call and sends the associated state event to alert other members that the room now has a group call.

string

The room the call is to be placed in.

GroupCallType

boolean

GroupCallIntent

boolean

IGroupCallDataChannelOptions

Promise<GroupCall>

DigitalWorldClient.createGroupCall


createMessagesRequest(roomId, fromToken, limit?, dir, timelineFilter?): Promise<IMessagesResponse>

Defined in: src/client.ts:4905

Makes a request to /messages with the appropriate lazy loading filter set. XXX: if we do get rid of scrollback (as it’s not used at the moment), we could inline this method again in paginateEventTimeline as that would then be the only call-site

string

string | null

number = 30

the maximum amount of events the retrieve

Direction

‘f’ or ‘b’

Filter

the timeline filter to pass

Promise<IMessagesResponse>

DigitalWorldClient.createMessagesRequest


createRoom(options): Promise<{ room_id: string; }>

Defined in: src/client.ts:6850

Create a new room.

ICreateRoomOpts

a list of options to pass to the /createRoom API.

Promise<{ room_id: string; }>

Promise which resolves: {room_id: {string}}

DigitalWorldClient.createRoom


createThreadListMessagesRequest(roomId, fromToken, limit?, dir?, threadListType?, timelineFilter?): Promise<IMessagesResponse>

Defined in: src/client.ts:4951

Makes a request to /messages with the appropriate lazy loading filter set. XXX: if we do get rid of scrollback (as it’s not used at the moment), we could inline this method again in paginateEventTimeline as that would then be the only call-site

string

string | null

number = 30

the maximum amount of events the retrieve

Direction = Direction.Backward

‘f’ or ‘b’

ThreadFilterType | null

Filter

the timeline filter to pass

Promise<IMessagesResponse>

DigitalWorldClient.createThreadListMessagesRequest


deactivateAccount(auth?, erase?): Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Defined in: src/client.ts:6790

Deactivates the logged-in account. Obviously, further calls that require authorisation should fail after this method is called. The state of the DigitalWorldClient object is not affected: it is up to the caller to either reset or destroy the DigitalWorldClient after this method succeeds.

AuthDict

Optional. Auth data to supply for User-Interactive auth.

boolean

Optional. If set, send as erase attribute in the JSON request body, indicating whether the account should be erased. Defaults to false.

Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Promise which resolves: On success, the empty object

DigitalWorldClient.deactivateAccount


deactivateSynapseUser(userId): Promise<ISynapseAdminDeactivateResponse>

Defined in: src/client.ts:6082

Deactivates a user using Synapse’s administrator API. This function is implementation specific and may change as a result.

string

the User ID to deactivate.

Promise<ISynapseAdminDeactivateResponse>

the deactivate response - see Synapse docs for information.

DigitalWorldClient.deactivateSynapseUser


decryptEventIfNeeded(event, options?): Promise<void>

Defined in: src/client.ts:6419

Attempts to decrypt an event

DigitalWorldEvent

The event to decrypt

IDecryptOptions

Promise<void>

A decryption promise

DigitalWorldClient.decryptEventIfNeeded


deleteAccountData(eventType): Promise<void>

Defined in: src/client.ts:2351

keyof AccountDataEvents

Promise<void>

DigitalWorldClient.deleteAccountData


deleteAlias(alias): Promise<EmptyObject>

Defined in: src/client.ts:7222

Delete an alias to room ID mapping. This alias must be on your local server, and you must have sufficient access to do this operation.

string

The room alias to delete.

Promise<EmptyObject>

Promise which resolves: an empty object {}.

DigitalWorldClient.deleteAlias


deleteDevice(deviceId, auth?): Promise<EmptyObject>

Defined in: src/client.ts:7701

Delete the given device

string

device to delete

AuthDict

Optional. Auth data to supply for User-Interactive auth.

Promise<EmptyObject>

Promise which resolves: result object

DigitalWorldClient.deleteDevice


deleteExtendedProfileProperty(key): Promise<void>

Defined in: src/client.ts:7486

Delete a property on your extended profile.

string

The key of the property to delete.

Promise<void>

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133 OR the server disallows editing the user profile.

DigitalWorldClient.deleteExtendedProfileProperty


deleteKeysFromBackup(roomId, sessionId, version?): Promise<void>

Defined in: src/client.ts:2140

undefined

undefined

string

Promise<void>

DigitalWorldClient.deleteKeysFromBackup

deleteKeysFromBackup(roomId, sessionId, version?): Promise<void>

Defined in: src/client.ts:2141

string

undefined

string

Promise<void>

DigitalWorldClient.deleteKeysFromBackup

deleteKeysFromBackup(roomId, sessionId, version?): Promise<void>

Defined in: src/client.ts:2142

string

string

string

Promise<void>

DigitalWorldClient.deleteKeysFromBackup


deleteMultipleDevices(devices, auth?): Promise<EmptyObject>

Defined in: src/client.ts:7723

Delete multiple device

string[]

IDs of the devices to delete

AuthDict

Optional. Auth data to supply for User-Interactive auth.

Promise<EmptyObject>

Promise which resolves: result object

DigitalWorldClient.deleteMultipleDevices


deletePushRule(scope, kind, ruleId): Promise<EmptyObject>

Defined in: src/client.ts:7844

string

PushRuleKind

string

Promise<EmptyObject>

Promise which resolves: an empty object {}

DigitalWorldClient.deletePushRule


deleteRoomTag(roomId, tagName): Promise<EmptyObject>

Defined in: src/client.ts:2595

string

string

name of room tag to be removed

Promise<EmptyObject>

Promise which resolves: to an empty object

DigitalWorldClient.deleteRoomTag


deleteThreePid(medium, address): Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Defined in: src/client.ts:7627

string

The threepid medium (eg. ‘email’)

string

The threepid address (eg. ‘bob@example.com’) this must be as returned by getThreePids.

Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Promise which resolves: The server response on success (generally the empty JSON object)

DigitalWorldClient.deleteThreePid


doesServerForceEncryptionForPreset(presetName): Promise<boolean>

Defined in: src/client.ts:6273

Query the server to see if it is forcing encryption to be enabled for a given room preset, based on the /versions response.

Preset

The name of the preset to check.

Promise<boolean>

true if the server is forcing encryption for the preset.

DigitalWorldClient.doesServerForceEncryptionForPreset


doesServerSupportExtendedProfiles(): Promise<boolean>

Defined in: src/client.ts:7360

Determine if the server supports extended profiles, as described by MSC4133.

Promise<boolean>

true if supported, otherwise false

DigitalWorldClient.doesServerSupportExtendedProfiles


doesServerSupportThread(): Promise<{ fwdPagination: FeatureSupport; list: FeatureSupport; threads: FeatureSupport; }>

Defined in: src/client.ts:6286

Promise<{ fwdPagination: FeatureSupport; list: FeatureSupport; threads: FeatureSupport; }>

DigitalWorldClient.doesServerSupportThread


doesServerSupportUnstableFeature(feature): Promise<boolean>

Defined in: src/client.ts:6259

Query the server to see if it lists support for an unstable feature in the /versions response

string

the feature name

Promise<boolean>

true if the feature is supported

DigitalWorldClient.doesServerSupportUnstableFeature


downloadKeysForUsers(userIds, token?): Promise<IDownloadKeyResult>

Defined in: src/client.ts:7939

Download device keys

string[]

list of users to get keys for

sync token to pass in the query request, to help the HS give the most recent results

string

Promise<IDownloadKeyResult>

Promise which resolves: result object. Rejects: with an error response (DigitalWorldError).

DigitalWorldClient.downloadKeysForUsers


emit<T>(event, …args): boolean

Defined in: src/models/typed-event-emitter.ts:86

Synchronously calls each of the listeners registered for the event named event, in the order they were registered, passing the supplied arguments to each.

T extends EmittedEvents

T

The name of the event to emit

Parameters<ClientEventHandlerMap[T]>

Arguments to pass to the listener

boolean

true if the event had listeners, false otherwise.

DigitalWorldClient.emit

emit<T>(event, …args): boolean

Defined in: src/models/typed-event-emitter.ts:87

Synchronously calls each of the listeners registered for the event named event, in the order they were registered, passing the supplied arguments to each.

T extends EmittedEvents

T

The name of the event to emit

Parameters<ClientEventHandlerMap[T]>

Arguments to pass to the listener

boolean

true if the event had listeners, false otherwise.

DigitalWorldClient.emit


emitPromised<T>(event, …args): Promise<boolean>

Defined in: src/models/typed-event-emitter.ts:98

Similar to emit but calls all listeners within a Promise.all and returns the promise chain

T extends EmittedEvents

T

The name of the event to emit

Parameters<ClientEventHandlerMap[T]>

Arguments to pass to the listener

Promise<boolean>

true if the event had listeners, false otherwise.

DigitalWorldClient.emitPromised

emitPromised<T>(event, …args): Promise<boolean>

Defined in: src/models/typed-event-emitter.ts:102

Similar to emit but calls all listeners within a Promise.all and returns the promise chain

T extends EmittedEvents

T

The name of the event to emit

Parameters<ClientEventHandlerMap[T]>

Arguments to pass to the listener

Promise<boolean>

true if the event had listeners, false otherwise.

DigitalWorldClient.emitPromised


encryptAndSendToDevice(eventType, devices, payload): Promise<void>

Defined in: src/embedded.ts:595

by DigitalWorldClient.encryptAndSendToDevice.

string

object[]

ToDevicePayload

Promise<void>

DigitalWorldClient.encryptAndSendToDevice


eventNames(): (string | symbol)[]

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:967

Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]

(string | symbol)[]

v6.0.0

DigitalWorldClient.eventNames


fetchCapabilities(): Promise<Capabilities>

Defined in: src/client.ts:1964

Fetches the latest capabilities from the hub, ignoring any cached versions. The newly returned version is cached.

Promise<Capabilities>

A promise which resolves to the capabilities of the hub

DigitalWorldClient.fetchCapabilities


fetchRelations(roomId, eventId, relationType, eventType?, opts?): Promise<IRelationsResponse>

Defined in: src/client.ts:6877

Fetches relations for a given event

string

the room of the event

string

the id of the event

string | null

the rel_type of the relations requested

string | null

the event type of the relations requested

IRelationsRequestOpts = ...

options with optional values for the request.

Promise<IRelationsResponse>

the response, with chunk, prev_batch and, next_batch.

DigitalWorldClient.fetchRelations


fetchRoomEvent(roomId, eventId): Promise<Partial<IEvent>>

Defined in: src/client.ts:6931

Get an event in a room by its event id.

string

string

Promise<Partial<IEvent>>

Promise which resolves to an object containing the event.

DigitalWorldClient.fetchRoomEvent


forget(roomId, deleteRoom?): Promise<EmptyObject>

Defined in: src/client.ts:4243

string

boolean = true

True to delete the room from the store on success. Default: true.

Promise<EmptyObject>

Promise which resolves: {} an empty object.

DigitalWorldClient.forget


generateClientSecret(): string

Defined in: src/client.ts:6410

Generates a random string suitable for use as a client secret. This method is experimental and may change.

string

A new client secret

DigitalWorldClient.generateClientSecret


getAccessToken(): string | null

Defined in: src/client.ts:6479

Get the access token associated with this account.

string | null

The access_token or null

DigitalWorldClient.getAccessToken


getAccountData<K>(eventType): DigitalWorldEvent | undefined

Defined in: src/client.ts:2313

Get account data event of given type for the current user.

K extends keyof AccountDataEvents

K

The event type

DigitalWorldEvent | undefined

The contents of the given account data event

DigitalWorldClient.getAccountData


getAccountDataFromServer<K>(eventType): Promise<AccountDataEvents[K] | null>

Defined in: src/client.ts:2325

Get account data event of given type for the current user. This variant gets account data directly from the hub if the local store is not ready, which can be useful very early in startup before the initial sync.

K extends keyof AccountDataEvents

K

The event type

Promise<AccountDataEvents[K] | null>

Promise which resolves: The contents of the given account data event.

DigitalWorldClient.getAccountDataFromServer


getAuthMetadata(): Promise<ValidatedAuthMetadata>

Defined in: src/client.ts:8896

Discover and validate the auth metadata for the OAuth 2.0 API.

When successful, validated metadata is returned.

Promise<ValidatedAuthMetadata>

validated authentication metadata

when delegated auth config is invalid or unreachable

DigitalWorldClient.getAuthMetadata


getCachedCapabilities(): Capabilities | undefined

Defined in: src/client.ts:1954

Gets the cached capabilities of the hub. If none have been fetched yet, return undefined.

Capabilities | undefined

The capabilities of the hub

DigitalWorldClient.getCachedCapabilities


getCanResetTimelineCallback(): ResetTimelineCallback | undefined

Defined in: src/client.ts:6349

Get the callback set via setCanResetTimelineCallback.

ResetTimelineCallback | undefined

The callback or null

DigitalWorldClient.getCanResetTimelineCallback


getCapabilities(): Promise<Capabilities>

Defined in: src/client.ts:1942

Gets the cached capabilities of the hub, returning cached ones if available. If there are no cached capabilities and none can be fetched, throw an exception.

Promise<Capabilities>

Promise resolving with The capabilities of the hub

DigitalWorldClient.getCapabilities


getCasLoginUrl(redirectUrl): string

Defined in: src/client.ts:6703

string

The URL to redirect to after the HS authenticates with CAS.

string

The HS URL to hit to begin the CAS login process.

DigitalWorldClient.getCasLoginUrl


getClientWellKnown(): IClientWellKnown | undefined

Defined in: src/client.ts:6095

IClientWellKnown | undefined

DigitalWorldClient.getClientWellKnown


getCrypto(): CryptoApi | undefined

Defined in: src/client.ts:2087

Access the crypto API for this client.

If end-to-end encryption has been enabled for this client (via initRustCrypto), returns an object giving access to the crypto API. Otherwise, returns undefined.

CryptoApi | undefined

DigitalWorldClient.getCrypto


getCurrentUploads(): Upload[]

Defined in: src/client.ts:7334

Get a list of all file uploads in progress

Upload[]

Array of objects representing current uploads. Currently in progress is element 0. Keys:

  • promise: The promise associated with the upload
  • loaded: Number of bytes uploaded
  • total: Total number of bytes to upload

DigitalWorldClient.getCurrentUploads


getDevice(deviceId): Promise<IMyDevice>

Defined in: src/client.ts:7669

Gets specific device details for the logged-in user

string

device to query

Promise<IMyDevice>

Promise which resolves: result object

DigitalWorldClient.getDevice


getDeviceId(): string | null

Defined in: src/client.ts:1704

Get the device ID of this client

string | null

device ID

DigitalWorldClient.getDeviceId


getDevices(): Promise<{ devices: IMyDevice[]; }>

Defined in: src/client.ts:7659

Gets all devices recorded for the logged-in user

Promise<{ devices: IMyDevice[]; }>

Promise which resolves: result object

DigitalWorldClient.getDevices


getDomain(): string | null

Defined in: src/client.ts:1685

Get the domain for this client’s Digital World ID

string | null

Domain of this Digital World ID

DigitalWorldClient.getDomain


getEventMapper(options?): EventMapper

Defined in: src/client.ts:4564

MapperOpts

EventMapper

DigitalWorldClient.getEventMapper


getEventTimeline(timelineSet, eventId): Promise<EventTimeline | null>

Defined in: src/client.ts:4622

Get an EventTimeline for the given event

If the EventTimelineSet object already has the given event in its store, the corresponding timeline will be returned. Otherwise, a /context request is made, and used to construct an EventTimeline. If the event does not belong to this EventTimelineSet then undefined will be returned.

EventTimelineSet

The timelineSet to look for the event in, must be bound to a room

string

The ID of the event to look for

Promise<EventTimeline | null>

Promise which resolves: EventTimeline including the given event

DigitalWorldClient.getEventTimeline


getExtendedProfile(userId): Promise<Record<string, unknown>>

Defined in: src/client.ts:7395

Fetch a user’s extended profile, which may include additional keys. Always returns all available profile fields, irrespective of what profile fields are set in the sync filter.

string

The user ID to fetch the profile of.

Promise<Record<string, unknown>>

A set of keys to property values.

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133.

A M_NOT_FOUND error if the profile could not be found.

DigitalWorldClient.getExtendedProfile


getExtendedProfileProperty(userId, key): Promise<unknown>

Defined in: src/client.ts:7426

Fetch a specific key from the user’s extended profile by checking local cache (which is updated from the sync) and querying the server if no data is cached locally.

string

The user ID to fetch the profile of.

string

The key of the property to fetch.

Promise<unknown>

The property value.

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133.

A M_NOT_FOUND error if the key was not set OR the profile could not be found.

DigitalWorldClient.getExtendedProfileProperty


getFallbackAuthUrl(loginType, authSessionId): string

Defined in: src/client.ts:6834

Get the fallback URL to use for unknown interactive-auth stages.

string

the type of stage being attempted

string

the auth session ID provided by the hub

string

HS URL to hit to for the fallback interface

DigitalWorldClient.getFallbackAuthUrl


getFilter(userId, filterId, allowCached): Promise<Filter>

Defined in: src/client.ts:5821

Retrieve a filter.

string

The user ID of the filter owner

string

The filter ID to retrieve

boolean

True to allow cached filters to be returned. Default: True.

Promise<Filter>

Promise which resolves: a Filter object

DigitalWorldClient.getFilter


getGroupCallForRoom(roomId): GroupCall | null

Defined in: src/client.ts:1839

Get an existing group call for the provided room.

string

GroupCall | null

The group call or null if it doesn’t already exist.

DigitalWorldClient.getGroupCallForRoom


getHubUrl(): string

Defined in: src/client.ts:6450

Get the Hub URL of this client

string

Hub URL of this client

DigitalWorldClient.getHubUrl


getIdentityAccount(identityAccessToken): Promise<{ user_id: string; }>

Defined in: src/client.ts:8427

Get account info from the identity server. This is useful as a neutral check to verify that other APIs are likely to approve access by testing that the token is valid, terms have been agreed, etc.

string

The access_token field of the Identity Server /account/register response (see registerWithIdentityServer).

Promise<{ user_id: string; }>

Promise which resolves: an object with account info.

DigitalWorldClient.getIdentityAccount


getIdentityHashDetails(identityAccessToken): Promise<{ algorithms: string[]; lookup_pepper: string; }>

Defined in: src/client.ts:8220

Gets the V2 hashing information from the identity server. Primarily useful for lookups.

string

The access token for the identity server.

Promise<{ algorithms: string[]; lookup_pepper: string; }>

The hashing information for the identity server.

DigitalWorldClient.getIdentityHashDetails


getIdentityServerUrl(stripProto?): string | undefined

Defined in: src/client.ts:6459

Get the identity server URL of this client

boolean = false

whether or not to strip the protocol from the URL

string | undefined

Identity server URL of this client

DigitalWorldClient.getIdentityServerUrl


getIgnoredUsers(): string[]

Defined in: src/client.ts:2373

Gets the users that are ignored by this client

string[]

The array of users that are ignored (empty if none)

DigitalWorldClient.getIgnoredUsers


getJoinedRoomMembers(roomId): Promise<IJoinedMembersResponse>

Defined in: src/client.ts:7163

Retrieve membership info. for a room.

string

ID of the room to get membership for

Promise<IJoinedMembersResponse>

Promise which resolves: A list of currently joined users and their profile data.

DigitalWorldClient.getJoinedRoomMembers


getJoinedRooms(): Promise<IJoinedRoomsResponse>

Defined in: src/client.ts:7151

Promise<IJoinedRoomsResponse>

Promise which resolves: A list of the user’s current rooms

DigitalWorldClient.getJoinedRooms


getKeyChanges(oldToken, newToken): Promise<{ changed: string[]; left: string[]; }>

Defined in: src/client.ts:7998

Ask the server for a list of users who have changed their device lists between a pair of sync tokens

string

string

Promise<{ changed: string[]; left: string[]; }>

Promise which resolves: result object. Rejects: with an error response (DigitalWorldError).

DigitalWorldClient.getKeyChanges


getLatestTimeline(timelineSet): Promise<EventTimeline | null>

Defined in: src/client.ts:4839

Get an EventTimeline for the latest events in the room. This will just call /messages to get the latest message in the room, then use client.getEventTimeline(...) to construct a new timeline from it.

EventTimelineSet

The timelineSet to find or add the timeline to

Promise<EventTimeline | null>

Promise which resolves: EventTimeline timeline with the latest events in the room

DigitalWorldClient.getLatestTimeline


getLivekitServiceURL(): string | undefined

Defined in: src/client.ts:1810

string | undefined

DigitalWorldClient.getLivekitServiceURL


getLocalAliases(roomId): Promise<{ aliases: string[]; }>

Defined in: src/client.ts:7236

Gets the local aliases for the room. Note: this includes all local aliases, unlike the curated list from the m.room.canonical_alias state event.

string

The room ID to get local aliases for.

Promise<{ aliases: string[]; }>

Promise which resolves: an object with an aliases property, containing an array of local aliases

DigitalWorldClient.getLocalAliases


getMaxListeners(): number

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:819

Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

number

v1.0.0

DigitalWorldClient.getMaxListeners


getMediaConfig(useAuthenticatedMedia?): Promise<IMediaConfig>

Defined in: src/client.ts:2158

Get the config for the media repository.

boolean = false

If true, the caller supports authenticated media and wants an authentication-required URL. Note that server support for authenticated media will not be checked - it is the caller’s responsibility to do so before calling this function.

Promise<IMediaConfig>

Promise which resolves with an object containing the config.

DigitalWorldClient.getMediaConfig


getMediaHandler(): MediaHandler

Defined in: src/client.ts:1727

MediaHandler

DigitalWorldClient.getMediaHandler


getNotifTimelineSet(): EventTimelineSet | null

Defined in: src/client.ts:1924

Return the global notification EventTimelineSet, if any

EventTimelineSet | null

the globl notification EventTimelineSet

DigitalWorldClient.getNotifTimelineSet


getOpenIdToken(): Promise<IOpenIDToken>

Defined in: src/embedded.ts:618

Gets a bearer token from the hub that the user can present to a third party in order to prove their ownership of the account they are logged into.

Promise<IOpenIDToken>

Promise which resolves: Token object

DigitalWorldClient.getOpenIdToken


getOrCreateFilter(filterName, filter): Promise<string>

Defined in: src/client.ts:5845

string

Filter

Promise<string>

Filter ID

DigitalWorldClient.getOrCreateFilter


getPresence(userId): Promise<IStatusResponse>

Defined in: src/client.ts:4468

string

The user to get presence for

Promise<IStatusResponse>

Promise which resolves: The presence state for this user.

DigitalWorldClient.getPresence


getProfileInfo(userId, info?): Promise<{ avatar_url?: string; displayname?: string; }>

Defined in: src/client.ts:7344

string

string

The kind of info to retrieve (e.g. ‘displayname’, ‘avatar_url’).

Promise<{ avatar_url?: string; displayname?: string; }>

Promise which resolves: TODO

DigitalWorldClient.getProfileInfo


getPushActionsForEvent(event, forceRecalculate?): IActionsObject | null

Defined in: src/client.ts:4316

Obtain a dict of actions which should be performed for this event according to the push rules for this user. Caches the dict on the event.

DigitalWorldEvent

The event to get push actions for.

boolean = false

forces to recalculate actions for an event Useful when an event just got decrypted

IActionsObject | null

A dict of actions to perform.

DigitalWorldClient.getPushActionsForEvent


getPushDetailsForEvent(event, forceRecalculate?): PushDetails | null

Defined in: src/client.ts:4332

Obtain a dict of actions which should be performed for this event according to the push rules for this user. Caches the dict on the event.

DigitalWorldEvent

The event to get push actions for.

boolean = false

forces to recalculate actions for an event Useful when an event just got decrypted

PushDetails | null

A dict of actions to perform.

DigitalWorldClient.getPushDetailsForEvent


getPushers(): Promise<{ pushers: IPusher[]; }>

Defined in: src/client.ts:7740

Gets all pushers registered for the logged-in user

Promise<{ pushers: IPusher[]; }>

Promise which resolves: Array of objects representing pushers

DigitalWorldClient.getPushers


getPushRules(): Promise<IPushRules>

Defined in: src/client.ts:7804

Get the push rules for the account from the server.

Promise<IPushRules>

Promise which resolves to the push rules.

DigitalWorldClient.getPushRules


getRefreshToken(): string | null

Defined in: src/client.ts:6487

Get the refresh token associated with this account.

string | null

The refresh_token or null

DigitalWorldClient.getRefreshToken


getRoom(roomId): Room | null

Defined in: src/client.ts:2173

Get the room for the given room ID. This function will return a valid room for any room for which a Room event has been emitted. Note in particular that other events, eg. RoomState.members will be emitted for a room before this function will return the given room.

string | undefined

The room ID

Room | null

The Room or null if it doesn’t exist or there is no data store.

DigitalWorldClient.getRoom


getRoomDirectoryVisibility(roomId): Promise<{ visibility: Visibility; }>

Defined in: src/client.ts:7261

Get the visibility of a room in the current HS’s room directory

string

Promise<{ visibility: Visibility; }>

Promise which resolves: TODO

DigitalWorldClient.getRoomDirectoryVisibility


getRoomHierarchy(roomId, limit?, maxDepth?, suggestedOnly?, fromToken?): Promise<IRoomHierarchy>

Defined in: src/client.ts:8619

Fetches or paginates a room hierarchy as defined by MSC2946. Falls back gracefully to sourcing its data from getSpaceSummary if this API is not yet supported by the server.

string

The ID of the space-room to use as the root of the summary.

number

The maximum number of rooms to return per page.

number

The maximum depth in the tree from the root room to return.

boolean = false

Whether to only return rooms with suggested=true.

string

The opaque token to paginate a previous request.

Promise<IRoomHierarchy>

the response, with next_batch & rooms fields.

DigitalWorldClient.getRoomHierarchy


getRoomIdForAlias(alias): Promise<{ room_id: string; servers: string[]; }>

Defined in: src/client.ts:7248

Get room info for the given alias.

string

The room alias to resolve.

Promise<{ room_id: string; servers: string[]; }>

Promise which resolves: Object with room_id and servers.

DigitalWorldClient.getRoomIdForAlias


getRoomPushRule(scope, roomId): IPushRule | undefined

Defined in: src/client.ts:5536

Get the room-kind push rule associated with a room.

"global" | "device"

“global” or device-specific.

string

the id of the room.

IPushRule | undefined

the rule or undefined.

DigitalWorldClient.getRoomPushRule


getRooms(): Room[]

Defined in: src/client.ts:2184

Retrieve all known rooms.

Room[]

A list of rooms, or an empty list if there is no data store.

DigitalWorldClient.getRooms


getRoomSummary(roomIdOrAlias, via?): Promise<RoomSummary>

Defined in: src/client.ts:8776

Fetches the summary of a room as defined by an initial version of MSC3266 and implemented in Synapse Proposed at https://github.com/matrix-org/matrix-doc/pull/3266

string

The ID or alias of the room to get the summary of.

string[]

The list of servers which know about the room if only an ID was provided.

Promise<RoomSummary>

DigitalWorldClient.getRoomSummary


getRoomTags(roomId): Promise<ITagsResponse>

Defined in: src/client.ts:2567

string

Promise<ITagsResponse>

Promise which resolves: to an object keyed by tagId with objects containing a numeric order field.

DigitalWorldClient.getRoomTags


getRoomUpgradeHistory(roomId, verifyLinks?, msc3946ProcessDynamicPredecessor?): Room[]

Defined in: src/client.ts:4015

Determines the history of room upgrades for a given room, as far as the client can see. Returns an array of Rooms where the first entry is the oldest and the last entry is the newest (likely current) room. If the provided room is not found, this returns an empty list. This works in both directions, looking for older and newer rooms of the given room.

string

The room ID to search from

boolean = false

If true, the function will only return rooms which can be proven to be linked. For example, rooms which have a create event pointing to an old room which the client is not aware of or doesn’t have a matching tombstone would not be returned.

boolean = false

if true, look for m.room.predecessor state events as well as create events, and prefer predecessor events where they exist (MSC3946).

Room[]

An array of rooms representing the upgrade history.

DigitalWorldClient.getRoomUpgradeHistory


getSafeUserId(): string

Defined in: src/client.ts:1673

Get the user-id of the logged-in user

string

Digital World ID for the logged-in user

Error if not logged in

DigitalWorldClient.getSafeUserId


getScheduler(): DigitalWorldScheduler<ISendEventResponse> | undefined

Defined in: src/client.ts:1902

Return the provided scheduler, if any.

DigitalWorldScheduler<ISendEventResponse> | undefined

The scheduler or undefined

DigitalWorldClient.getScheduler


getSessionId(): string

Defined in: src/client.ts:1712

Get the session ID of this client

string

session ID

DigitalWorldClient.getSessionId


getSsoLoginUrl(redirectUrl, loginType?, idpId?, action?): string

Defined in: src/client.ts:6716

string

The URL to redirect to after the HS authenticates with the SSO.

string = "sso"

The type of SSO login we are doing (sso or cas). Defaults to ‘sso’.

string

The ID of the Identity Provider being targeted, optional.

SSOAction

the SSO flow to indicate to the IdP, optional.

string

The HS URL to hit to begin the SSO login process.

DigitalWorldClient.getSsoLoginUrl


getStateEvent(roomId, eventType, stateKey): Promise<Record<string, any>>

Defined in: src/client.ts:6996

Retrieve a state event.

string

string

string

Promise<Record<string, any>>

Promise which resolves: TODO

DigitalWorldClient.getStateEvent


getSyncState(): SyncState | null

Defined in: src/embedded.ts:672

Get the current sync state.

SyncState | null

the sync state, which may be null.

DigitalWorldClient#event:“sync”

DigitalWorldClient.getSyncState


getSyncStateData(): SyncStateData | null

Defined in: src/client.ts:1859

Returns the additional data object associated with the current sync state, or null if there is no such data. Sync errors, if available, are put in the ‘error’ key of this object.

SyncStateData | null

DigitalWorldClient.getSyncStateData


getTerms(serviceType, baseUrl): Promise<Terms>

Defined in: src/client.ts:8550

SERVICE_TYPES

string

Promise<Terms>

DigitalWorldClient.getTerms


getThirdpartyLocation(protocol, params): Promise<IThirdPartyLocation[]>

Defined in: src/client.ts:8523

Get information on how a specific place on a third party protocol may be reached.

string

The protocol given in getThirdpartyProtocols()

Protocol-specific parameters, as given in the response to getThirdpartyProtocols()

string[]

Promise<IThirdPartyLocation[]>

Promise which resolves to the result object

DigitalWorldClient.getThirdpartyLocation


getThirdpartyProtocols(): Promise<{[protocol: string]: IProtocol; }>

Defined in: src/client.ts:8503

Get the third party protocols that can be reached using this HS

Promise<{[protocol: string]: IProtocol; }>

Promise which resolves to the result object

DigitalWorldClient.getThirdpartyProtocols


getThirdpartyUser(protocol, params?): Promise<IThirdPartyUser[]>

Defined in: src/client.ts:8542

Get information on how a specific user on a third party protocol may be reached.

string

The protocol given in getThirdpartyProtocols()

QueryDict

Protocol-specific parameters, as given in the response to getThirdpartyProtocols()

Promise<IThirdPartyUser[]>

Promise which resolves to the result object

DigitalWorldClient.getThirdpartyUser


getThreadTimeline(timelineSet, eventId): Promise<EventTimeline | undefined>

Defined in: src/client.ts:4692

EventTimelineSet

string

Promise<EventTimeline | undefined>

DigitalWorldClient.getThreadTimeline


getThreePids(): Promise<{ threepids: IThreepid[]; }>

Defined in: src/client.ts:7560

Promise<{ threepids: IThreepid[]; }>

Promise which resolves to a list of the user’s threepids.

DigitalWorldClient.getThreePids


getTurnServers(): ITurnServer[]

Defined in: src/client.ts:5963

Get the TURN servers for this hub.

ITurnServer[]

The servers or an empty list.

DigitalWorldClient.getTurnServers


getTurnServersExpiry(): number

Defined in: src/client.ts:5972

Get the unix timestamp (in milliseconds) at which the current TURN credentials (from getTurnServers) expire

number

The expiry timestamp in milliseconds

DigitalWorldClient.getTurnServersExpiry


getUrlPreview(url, ts): Promise<IPreviewUrlResponse>

Defined in: src/client.ts:3940

Get a preview of the given URL as of (roughly) the given point in time, described as an object with OpenGraph keys and associated values. Attributes may be synthesized where actual OG metadata is lacking. Caches results to prevent hammering the server.

string

The URL to get preview data for

number

The preferred point in time that the preview should describe (ms since epoch). The preview returned will either be the most recent one preceding this timestamp if available, or failing that the next most recent available preview.

Promise<IPreviewUrlResponse>

Promise which resolves: Object of OG metadata.

DigitalWorldClient.getUrlPreview


getUseE2eForGroupCall(): boolean

Defined in: src/client.ts:1754

Returns true if to-device signalling for group calls will be encrypted with Olm. If false, it will be sent unencrypted.

boolean

boolean Whether group call signalling will be encrypted

DigitalWorldClient.getUseE2eForGroupCall


getUser(userId): User | null

Defined in: src/client.ts:2218

Retrieve a user.

string

The user ID to retrieve.

User | null

A user or null if there is no data store or the user does not exist.

DigitalWorldClient.getUser


getUserId(): string | null

Defined in: src/client.ts:1663

Get the user-id of the logged-in user

string | null

Digital World ID for the logged-in user, or null if not logged in

DigitalWorldClient.getUserId


getUserIdLocalpart(): string | null

Defined in: src/client.ts:1696

Get the local part of the current user ID e.g. “foo” in “@foo:bar”.

string | null

The user ID localpart or null.

DigitalWorldClient.getUserIdLocalpart


getUsers(): User[]

Defined in: src/client.ts:2226

Retrieve all known users.

User[]

A list of users, or an empty list if there is no data store.

DigitalWorldClient.getUsers


getVersions(): Promise<IServerVersions>

Defined in: src/client.ts:6220

Get the API versions supported by the server, along with any unstable APIs it supports

Promise<IServerVersions>

The server /versions response

DigitalWorldClient.getVersions


getVisibleRooms(msc3946ProcessDynamicPredecessor?): Room[]

Defined in: src/client.ts:2199

Retrieve all rooms that should be displayed to the user This is essentially getRooms() with some rooms filtered out, eg. old versions of rooms that have been replaced or (in future) other rooms that have been marked at the protocol level as not to be displayed to the user.

boolean = false

if true, look for an m.room.predecessor state event and use it if found (MSC3946).

Room[]

A list of rooms, or an empty list if there is no data store.

DigitalWorldClient.getVisibleRooms


hasLazyLoadMembersEnabled(): boolean

Defined in: src/client.ts:6328

Get if lazy loading members is being used.

boolean

Whether or not members are lazy loaded by this client

DigitalWorldClient.hasLazyLoadMembersEnabled


identityHashedLookup(addressPairs, identityAccessToken): Promise<object[]>

Defined in: src/client.ts:8250

Performs a hashed lookup of addresses against the identity server. This is only supported on identity servers which have at least the version 2 API.

[string, string][]

An array of 2 element arrays. The first element of each pair is the address, the second is the 3PID medium. Eg: ["email@example.org", "email"]

string

The access token for the identity server.

Promise<object[]>

A collection of address mappings to found Digital World IDs. Results where no user could be found will not be listed.

DigitalWorldClient.identityHashedLookup


initRustCrypto(args?): Promise<void>

Defined in: src/client.ts:1988

Initialise support for end-to-end encryption in this client, using the rust matrix-sdk-crypto.

WARNING: the cryptography stack is not thread-safe. Having multiple DigitalWorldClient instances connected to the same Indexed DB will cause data corruption and decryption failures. The application layer is responsible for ensuring that only one DigitalWorldClient issue is instantiated at a time.

string

The database name to use for indexeddb, defaults to ‘digital-world-messaging-sdk’. Unused if useIndexedDB is ‘false’.

Uint8Array<ArrayBufferLike>

A key with which to encrypt the indexeddb store. If provided, it must be exactly 32 bytes of data, and must be the same each time the client is initialised for a given device. If both this and storagePassword are unspecified, the store will be unencrypted.

string

An alternative to storageKey. A password which will be used to derive a key to encrypt the store with. Deriving a key from a password is (deliberately) a slow operation, so prefer to pass a storageKey directly where possible.

boolean

True to use an indexeddb store, false to use an in-memory store. Defaults to ‘true’.

Promise<void>

a Promise which will resolve when the crypto layer has been successfully initialised.

DigitalWorldClient.initRustCrypto


invite(roomId, userId, opts?): Promise<EmptyObject>

Defined in: src/client.ts:4104

Send an invite to the given user to join the given room.

string

The ID of the room to which the user should be invited.

string

The ID of the user that should be invited.

string | InviteOpts

Optional reason object. For backwards compatibility, a string is also accepted, and will be interpreted as a reason.

Promise<EmptyObject>

An empty object.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.invite


inviteByEmail(roomId, email): Promise<EmptyObject>

Defined in: src/client.ts:4129

Invite a user to a room based on their email address.

string

The room to invite the user to.

string

The email address to invite.

Promise<EmptyObject>

Promise which resolves: {} an empty object.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.inviteByEmail


inviteByThreePid(roomId, medium, address): Promise<EmptyObject>

Defined in: src/client.ts:4143

Invite a user to a room based on a third-party identifier.

string

The room to invite the user to.

string

The medium to invite the user e.g. “email”.

string

The address for the specified medium.

Promise<EmptyObject>

Promise which resolves: {} an empty object.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.inviteByThreePid


isFallbackICEServerAllowed(): boolean

Defined in: src/client.ts:6046

Get whether to allow a fallback ICE server should be used for negotiating a WebRTC connection if the hub doesn’t provide any servers. Defaults to false.

boolean

DigitalWorldClient.isFallbackICEServerAllowed


isGuest(): boolean

Defined in: src/client.ts:1882

Return whether the client is configured for a guest account.

boolean

True if this is a guest access_token (or no token is supplied).

DigitalWorldClient.isGuest


isInitialSyncComplete(): boolean

Defined in: src/client.ts:1870

Whether the initial sync has completed.

boolean

True if at least one sync has happened.

DigitalWorldClient.isInitialSyncComplete


isKeyBackupKeyStored(): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>

Defined in: src/client.ts:2118

Check whether the key backup private key is stored in secret storage.

Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>

map of key name to key info the secret is encrypted with, or null if it is not present or not encrypted with a trusted key

DigitalWorldClient.isKeyBackupKeyStored


isLoggedIn(): boolean

Defined in: src/client.ts:6504

boolean

true if there is a valid access_token for this client.

DigitalWorldClient.isLoggedIn


isRoomEncrypted(roomId): boolean

Defined in: src/client.ts:2099

Whether encryption is enabled for a room.

string

the room id to query.

boolean

whether encryption is enabled.

DigitalWorldClient.isRoomEncrypted


isSynapseAdministrator(): Promise<boolean>

Defined in: src/client.ts:6057

Determines if the current user is an administrator of the Synapse hub. Returns false if untrue or the hub does not appear to be a Synapse hub. This function is implementation specific and may change as a result.

Promise<boolean>

true if the user appears to be a Synapse administrator.

DigitalWorldClient.isSynapseAdministrator


isUserIgnored(userId): boolean

Defined in: src/client.ts:2398

Gets whether or not a specific user is being ignored by this client.

string

the user ID to check

boolean

true if the user is ignored, false otherwise

DigitalWorldClient.isUserIgnored


isUsernameAvailable(username): Promise<boolean>

Defined in: src/client.ts:6523

Check whether a username is available prior to registration. An error response indicates an invalid/unavailable username.

string

The username to check the availability of.

Promise<boolean>

Promise which resolves: to boolean of whether the username is available.

DigitalWorldClient.isUsernameAvailable


isVersionSupported(version): Promise<boolean>

Defined in: src/client.ts:6248

Check if a particular spec version is supported by the server.

string

The spec version (such as “r0.5.0”) to check for.

Promise<boolean>

Whether it is supported

DigitalWorldClient.isVersionSupported


joinRoom(roomIdOrAlias): Promise<Room>

Defined in: src/embedded.ts:373

Join a room. If you have already joined the room, this will no-op.

string

The room ID or room alias to join.

Promise<Room>

Promise which resolves: Room object.

DigitalWorldClient.joinRoom


kick(roomId, userId, reason?): Promise<EmptyObject>

Defined in: src/client.ts:4280

string

string

string

Optional.

Promise<EmptyObject>

Promise which resolves: {} an empty object.

DigitalWorldClient.kick


knockRoom(roomIdOrAlias, opts?): Promise<{ room_id: string; }>

Defined in: src/client.ts:2472

Knock a room. If you have already knocked the room, this will no-op.

string

The room ID or room alias to knock.

KnockRoomOpts = {}

Options when knocking the room.

Promise<{ room_id: string; }>

Promise which resolves: {room_id: {string}}

DigitalWorldClient.knockRoom


leave(roomId): Promise<EmptyObject>

Defined in: src/client.ts:4175

string

Promise<EmptyObject>

Promise which resolves: {} an empty object.

DigitalWorldClient.leave


leaveRoomChain(roomId, includeFuture?): Promise<{[roomId: string]: Error | DigitalWorldError | null; }>

Defined in: src/client.ts:4190

Leaves all rooms in the chain of room upgrades based on the given room. By default, this will leave all the previous and upgraded rooms, including the given room. To only leave the given room and any previous rooms, keeping the upgraded (modern) rooms untouched supply false to includeFuture.

string

The room ID to start leaving at

boolean = true

If true, the whole chain (past and future) of upgraded rooms will be left.

Promise<{[roomId: string]: Error | DigitalWorldError | null; }>

Promise which resolves when completed with an object keyed by room ID and value of the error encountered when leaving or null.

DigitalWorldClient.leaveRoomChain


listenerCount(event): number

Defined in: src/models/typed-event-emitter.ts:115

Returns the number of listeners listening to the event named event.

EventEmitterEvents | EmittedEvents

The name of the event being listened for

number

DigitalWorldClient.listenerCount


listeners(event): Function[]

Defined in: src/models/typed-event-emitter.ts:122

Returns a copy of the array of listeners for the event named event.

EventEmitterEvents | EmittedEvents

Function[]

DigitalWorldClient.listeners


login(loginType, data): Promise<LoginResponse>

Defined in: src/client.ts:6668

string

Omit<LoginRequest, "type">

Promise<LoginResponse>

Promise which resolves to a LoginResponse object

DigitalWorldClient.login


loginFlows(): Promise<ILoginFlowsResponse>

Defined in: src/client.ts:6656

Promise<ILoginFlowsResponse>

Promise which resolves to the available login flows

DigitalWorldClient.loginFlows


loginRequest(data): Promise<LoginResponse>

Defined in: src/client.ts:6756

Sends a POST /login request to the server.

If successful, this will create a new device and access token for the user.

LoginRequest

Credentials and other details for the login request.

Promise<LoginResponse>

DigitalWorldClient.loginRequest


loginWithPassword(user, password): Promise<LoginResponse>

Defined in: src/client.ts:6691

string

string

Promise<LoginResponse>

Promise which resolves to a LoginResponse object

DigitalWorldClient.loginWithPassword


loginWithToken(token): Promise<LoginResponse>

Defined in: src/client.ts:6740

string

Login token previously received from hub

Promise<LoginResponse>

Promise which resolves to a LoginResponse object

DigitalWorldClient.loginWithToken


logout(stopClient?): Promise<EmptyObject>

Defined in: src/client.ts:6769

Logs out the current session. Obviously, further calls that require authorisation should fail after this method is called. The state of the DigitalWorldClient object is not affected: it is up to the caller to either reset or destroy the DigitalWorldClient after this method succeeds.

boolean = false

whether to stop the client before calling /logout to prevent invalid token errors.

Promise<EmptyObject>

Promise which resolves: On success, the empty object {}

DigitalWorldClient.logout


lookupThreePid(medium, address, identityAccessToken): Promise<EmptyObject | { address: string; medium: string; mxid: string; }>

Defined in: src/client.ts:8337

Looks up the public Digital World ID mapping for a given 3rd party identifier from the identity server

string

The medium of the threepid, eg. ‘email’

string

The textual address of the threepid

string

The access_token field of the Identity Server /account/register response (see registerWithIdentityServer).

Promise<EmptyObject | { address: string; medium: string; mxid: string; }>

Promise which resolves: A threepid mapping object or the empty object if no mapping exists

DigitalWorldClient.lookupThreePid


makeTxnId(): string

Defined in: src/client.ts:6513

Make up a new transaction id

string

a new, unique, transaction id

DigitalWorldClient.makeTxnId


members(roomId, includeMembership?, excludeMembership?, atEventId?): Promise<{[userId: string]: IStateEventWithRoomId[]; }>

Defined in: src/client.ts:6946

string

string

the membership type to include in the response

string

the membership type to exclude from the response

string

the id of the event for which moment in the timeline the members should be returned for

Promise<{[userId: string]: IStateEventWithRoomId[]; }>

Promise which resolves: dictionary of userid to profile information

DigitalWorldClient.members


mxcUrlToHttp(mxcUrl, width?, height?, resizeMethod?, allowDirectLinks?, allowRedirects?, useAuthentication?): string | null

Defined in: src/client.ts:4414

Turn an MXC URL into an HTTP one. This method is experimental and may change.

string

The MXC URL

number

The desired width of the thumbnail.

number

The desired height of the thumbnail.

string

The thumbnail resize method to use, either “crop” or “scale”.

boolean

If true, return any non-mxc URLs directly. Fetching such URLs will leak information about the user to anyone they share a room with. If false, will return null for such URLs.

boolean

If true, the caller supports the URL being 307 or 308 redirected to another resource upon request. If false, redirects are not expected. Implied true when useAuthentication is true.

boolean

If true, the caller supports authenticated media and wants an authentication-required URL. Note that server support for authenticated media will not be checked - it is the caller’s responsibility to do so before calling this function. Note also that useAuthentication implies allowRedirects. Defaults to false (unauthenticated endpoints).

string | null

the avatar URL or null.

DigitalWorldClient.mxcUrlToHttp


off<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:129

Alias for removeListener

T extends EventEmitterEvents | EmittedEvents

T

Listener<EmittedEvents, ClientEventHandlerMap, T>

this

DigitalWorldClient.off


on<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:150

Adds the listener function to the end of the listeners array for the event named event.

No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.

By default, event listeners are invoked in the order they are added. The prependListener method can be used as an alternative to add the event listener to the beginning of the listeners array.

T extends EventEmitterEvents | EmittedEvents

T

The name of the event.

Listener<EmittedEvents, ClientEventHandlerMap, T>

The callback function

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.on


once<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:169

Adds a one-time listener function for the event named event. The next time event is triggered, this listener is removed and then invoked.

Returns a reference to the EventEmitter, so that calls can be chained.

By default, event listeners are invoked in the order they are added. The prependOnceListener method can be used as an alternative to add the event listener to the beginning of the listeners array.

T extends EventEmitterEvents | EmittedEvents

T

The name of the event.

Listener<EmittedEvents, ClientEventHandlerMap, T>

The callback function

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.once


paginateEventTimeline(eventTimeline, opts): Promise<boolean>

Defined in: src/client.ts:5016

Take an EventTimeline, and back/forward-fill results.

EventTimeline

timeline object to be updated

IPaginateOpts

Promise<boolean>

Promise which resolves to a boolean: false if there are no events and we reached either end of the timeline; else true.

DigitalWorldClient.paginateEventTimeline


patchExtendedProfile(profile): Promise<Record<string, unknown>>

Defined in: src/client.ts:7513

Update multiple properties on your extended profile. This will merge with any existing keys.

Record<string, unknown>

The profile object to merge with the existing profile.

Promise<Record<string, unknown>>

The newly merged profile.

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133 OR the server disallows editing the user profile.

DigitalWorldClient.patchExtendedProfile


peekInRoom(roomId, limit?): Promise<Room>

Defined in: src/client.ts:5285

Peek into a room and receive updates about the room. This only works if the history visibility for the room is world_readable.

string

The room to attempt to peek into.

number = 20

The number of timeline events to initially retrieve.

Promise<Room>

Promise which resolves: Room object

DigitalWorldClient.peekInRoom


prependListener<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:186

Adds the listener function to the beginning of the listeners array for the event named event.

No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.

T extends EventEmitterEvents | EmittedEvents

T

The name of the event.

Listener<EmittedEvents, ClientEventHandlerMap, T>

The callback function

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.prependListener


prependOnceListener<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:202

Adds a one-timelistener function for the event named event to the beginning of the listeners array. The next time event is triggered, this listener is removed, and then invoked.

T extends EventEmitterEvents | EmittedEvents

T

The name of the event.

Listener<EmittedEvents, ClientEventHandlerMap, T>

The callback function

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.prependOnceListener


processAggregatedTimelineEvents(room?, events?): void

Defined in: src/client.ts:8825

Calls aggregation functions for event types that are aggregated Polls and location beacons

Room

room the events belong to

DigitalWorldEvent[]

timeline events to be processed

void

DigitalWorldClient.processAggregatedTimelineEvents


processBeaconEvents(room?, events?): void

Defined in: src/client.ts:8814

Room

DigitalWorldEvent[]

void

DigitalWorldClient.processBeaconEvents


processThreadEvents(room, threadedEvents, toStartOfTimeline): void

Defined in: src/client.ts:8799

Processes a list of threaded events and adds them to their respective timelines

Room

the room the adds the threaded events

DigitalWorldEvent[]

an array of the threaded events

boolean

the direction in which we want to add the events

void

DigitalWorldClient.processThreadEvents


processThreadRoots(room, threadedEvents, toStartOfTimeline): void

Defined in: src/client.ts:8809

Processes a list of thread roots and creates a thread model

Room

the room to create the threads in

DigitalWorldEvent[]

an array of thread roots

boolean

the direction

void

DigitalWorldClient.processThreadRoots


publicRooms(params?): Promise<IPublicRoomsResponse>

Defined in: src/client.ts:7178

Get the public rooms list from the server. Supports pagination

IRoomDirectoryOptions = {}

Options for this request

Promise<IPublicRoomsResponse>

Promise which resolves: IPublicRoomsResponse

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.publicRooms


queueToDevice(batch): Promise<void>

Defined in: src/embedded.ts:630

Sends events directly to specific devices using the protocol’s to-device messaging system. The batch will be split up into appropriately sized batches for sending and stored in the store so they can be retried later if they fail to send. Retries will happen automatically.

ToDeviceBatch

The to-device messages to send

Promise<void>

DigitalWorldClient.queueToDevice


rawListeners(event): Function[]

Defined in: src/models/typed-event-emitter.ts:243

Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

EventEmitterEvents | EmittedEvents

Function[]

DigitalWorldClient.rawListeners


redactEvent(roomId, eventId, txnId?, opts?): Promise<ISendEventResponse>

Defined in: src/client.ts:3148

string

string

string

transaction id. One will be made up if not supplied.

IRedactOpts

Redact options

Promise<ISendEventResponse>

Promise which resolves: TODO

Error if called with with_rel_types (MSC3912) but the server does not support it. Callers should check whether the server supports MSC3912 via DigitalWorldClient.canSupport.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.redactEvent

redactEvent(roomId, threadId, eventId, txnId?, opts?): Promise<ISendEventResponse>

Defined in: src/client.ts:3154

string

string | null

string

string

transaction id. One will be made up if not supplied.

IRedactOpts

Redact options

Promise<ISendEventResponse>

Promise which resolves: TODO

Error if called with with_rel_types (MSC3912) but the server does not support it. Callers should check whether the server supports MSC3912 via DigitalWorldClient.canSupport.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.redactEvent


refreshToken(refreshToken): Promise<IRefreshTokenResponse>

Defined in: src/client.ts:6628

Refreshes an access token using a provided refresh token. The refresh token must be valid for the current access token known to the client instance.

Note that this function will not cause a logout if the token is deemed unknown by the server - the caller is responsible for managing logout actions on error.

string

The refresh token.

Promise<IRefreshTokenResponse>

Promise which resolves to the new token.

DigitalWorldClient.refreshToken


register(username, password, sessionId, auth, bindThreepids?, guestAccessToken?, inhibitLogin?): Promise<RegisterResponse>

Defined in: src/client.ts:6544

string

string

string | null

string

string

Set key ‘email’ to true to bind any email threepid uses during registration in the identity server. Set ‘msisdn’ to true to bind msisdn.

boolean

boolean

string

boolean

Promise<RegisterResponse>

Promise which resolves to a RegisterResponse object

DigitalWorldClient.register


registerGuest(body?): Promise<RegisterResponse>

Defined in: src/client.ts:6598

Register a guest account. This method returns the auth info needed to create a new authenticated client, Remember to call setGuest(true) on the (guest-)authenticated client, e.g:

const tmpClient = await sdk.createClient(HUB_INSTANCE);
const { user_id, device_id, access_token } = tmpClient.registerGuest();
const client = createClient({
baseUrl: HUB_INSTANCE,
accessToken: access_token,
userId: user_id,
deviceId: device_id,
})
client.setGuest(true);

JSON HTTP body to provide.

RegisterRequest

Promise<RegisterResponse>

Promise which resolves: JSON object that contains: { user_id, device_id, access_token, home_server }

DigitalWorldClient.registerGuest


registerRequest(data, kind?): Promise<RegisterResponse>

Defined in: src/client.ts:6608

RegisterRequest

parameters for registration request

string

type of user to register. may be “guest”

Promise<RegisterResponse>

Promise which resolves: to the /register response

DigitalWorldClient.registerRequest


registerWithIdentityServer(hsOpenIdToken): Promise<{ access_token: string; token: string; }>

Defined in: src/client.ts:8028

Register with an identity server using the OpenID token from the user’s Hub, which can be retrieved via DigitalWorldClient#getOpenIdToken.

Note that the /account/register endpoint (as well as IS authentication in general) was added as part of the v2 API version.

IOpenIDToken

Promise<{ access_token: string; token: string; }>

Promise which resolves: with object containing an Identity Server access token.

DigitalWorldClient.registerWithIdentityServer


relations(roomId, eventId, relationType, eventType?, opts?): Promise<{ events: DigitalWorldEvent[]; nextBatch?: string | null; originalEvent?: DigitalWorldEvent | null; prevBatch?: string | null; }>

Defined in: src/client.ts:6364

Returns relations for a given event. Handles encryption transparently, with the caveat that the amount of events returned might be 0, even though you get a nextBatch. When the returned promise resolves, all messages should have finished trying to decrypt.

string

the room of the event

string

the id of the event

string | null

the rel_type of the relations requested

string | null

the event type of the relations requested

IRelationsRequestOpts = ...

options with optional values for the request.

Promise<{ events: DigitalWorldEvent[]; nextBatch?: string | null; originalEvent?: DigitalWorldEvent | null; prevBatch?: string | null; }>

an object with events as DigitalWorldEvent[] and optionally nextBatch if more relations are available.

DigitalWorldClient.relations


removeAllListeners(event?): this

Defined in: src/models/typed-event-emitter.ts:219

Removes all listeners, or those of the specified event.

It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

EventEmitterEvents | EmittedEvents

The name of the event. If undefined, all listeners everywhere are removed.

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.removeAllListeners


removeListener<T>(event, listener): this

Defined in: src/models/typed-event-emitter.ts:232

Removes the specified listener from the listener array for the event named event.

T extends EventEmitterEvents | EmittedEvents

T

Listener<EmittedEvents, ClientEventHandlerMap, T>

this

a reference to the EventEmitter, so that calls can be chained.

DigitalWorldClient.removeListener


removePusher(pushKey, appId): Promise<EmptyObject>

Defined in: src/client.ts:7776

Removes an existing pusher

string

pushkey of pusher to remove

string

app_id of pusher to remove

Promise<EmptyObject>

Promise which resolves: Empty json object on success

DigitalWorldClient.removePusher


reportEvent(roomId, eventId, score, reason): Promise<EmptyObject>

Defined in: src/client.ts:8583

Reports an event as inappropriate to the server, which may then notify the appropriate people.

string

The room in which the event being reported is located.

string

The event to report.

number

The score to rate this content as where -100 is most offensive and 0 is inoffensive.

string

The reason the content is being reported. May be blank.

Promise<EmptyObject>

Promise which resolves to an empty object if successful

DigitalWorldClient.reportEvent


reportRoom(roomId, reason): Promise<EmptyObject>

Defined in: src/client.ts:8601

Reports a room as inappropriate to the server, which may then notify the appropriate people.

This API was introduced in protocol v1.13.

string

The room being reported.

string

The reason the room is being reported. May be blank.

Promise<EmptyObject>

Promise which resolves to an empty object if successful

DigitalWorldClient.reportRoom


requestAdd3pidEmailToken(email, clientSecret, sendAttempt, nextLink?): Promise<IRequestTokenResponse>

Defined in: src/client.ts:5408

Requests an email verification token for the purposes of adding a third party identifier to an account. This API requests a token from the hub. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided. If an account with the given email address already exists and is associated with an account other than the one the user is authed as, it will either send an email to the address informing them of this or return M_THREEPID_IN_USE (which one is up to the hub).

string

As requestEmailToken

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestAdd3pidEmailToken


requestAdd3pidMsisdnToken(phoneCountry, phoneNumber, clientSecret, sendAttempt, nextLink?): Promise<IRequestMsisdnTokenResponse>

Defined in: src/client.ts:5436

Requests a text message verification token for the purposes of adding a third party identifier to an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the addition of phone numbers to an account, as requestAdd3pidEmailToken.

string

As requestRegisterMsisdnToken

string

As requestRegisterMsisdnToken

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestMsisdnTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestAdd3pidMsisdnToken


requestEmailToken(email, clientSecret, sendAttempt, nextLink?, identityAccessToken?): Promise<IRequestTokenResponse>

Defined in: src/client.ts:8063

Requests an email verification token directly from an identity server.

This API is used as part of binding an email for discovery on an identity server. The validation data that results should be passed to the bindThreePid method to complete the binding process.

string

The email address to request a token for

string

A secret binary string generated by the client. It is recommended this be around 16 ASCII characters.

number

If an identity server sees a duplicate request with the same sendAttempt, it will not send another email. To request another email to be sent, use a larger value for the sendAttempt param as was used in the previous request.

string

Optional If specified, the client will be redirected to this link after validation.

string

The access_token field of the identity server /account/register response (see registerWithIdentityServer).

Promise<IRequestTokenResponse>

Promise which resolves: TODO

Error if no identity server is set

DigitalWorldClient.requestEmailToken


requestLoginToken(auth?): Promise<LoginTokenPostResponse>

Defined in: src/client.ts:6815

Make a request for an m.login.token to be issued as per https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token

The server may require User-Interactive auth.

AuthDict

Optional. Auth data to supply for User-Interactive auth.

Promise<LoginTokenPostResponse>

Promise which resolves: On success, the token response or UIA auth data.

DigitalWorldClient.requestLoginToken


requestMsisdnToken(phoneCountry, phoneNumber, clientSecret, sendAttempt, nextLink?, identityAccessToken?): Promise<IRequestMsisdnTokenResponse>

Defined in: src/client.ts:8114

Requests a MSISDN verification token directly from an identity server.

This API is used as part of binding a MSISDN for discovery on an identity server. The validation data that results should be passed to the bindThreePid method to complete the binding process.

string

The ISO 3166-1 alpha-2 code for the country in which phoneNumber should be parsed relative to.

string

The phone number, in national or international format

string

A secret binary string generated by the client. It is recommended this be around 16 ASCII characters.

number

If an identity server sees a duplicate request with the same sendAttempt, it will not send another SMS. To request another SMS to be sent, use a larger value for the sendAttempt param as was used in the previous request.

string

Optional If specified, the client will be redirected to this link after validation.

string

The access_token field of the Identity Server /account/register response (see registerWithIdentityServer).

Promise<IRequestMsisdnTokenResponse>

Promise which resolves to an object with a sid string

Error if no identity server is set

DigitalWorldClient.requestMsisdnToken


requestPasswordEmailToken(email, clientSecret, sendAttempt, nextLink?): Promise<IRequestTokenResponse>

Defined in: src/client.ts:5470

Requests an email verification token for the purposes of resetting the password on an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the password resetting. Specifically, if no account with the given email address exists, it may either return M_THREEPID_NOT_FOUND or send an email to the address informing them of this (which one is up to the hub).

requestEmailToken calls the equivalent API directly on the identity server, therefore bypassing the password reset specific logic.

string

As requestEmailToken

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestPasswordEmailToken


requestPasswordMsisdnToken(phoneCountry, phoneNumber, clientSecret, sendAttempt, nextLink): Promise<IRequestMsisdnTokenResponse>

Defined in: src/client.ts:5497

Requests a text message verification token for the purposes of resetting the password on an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the password resetting, as requestPasswordEmailToken.

string

As requestRegisterMsisdnToken

string

As requestRegisterMsisdnToken

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestMsisdnTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestPasswordMsisdnToken


requestRegisterEmailToken(email, clientSecret, sendAttempt, nextLink?): Promise<IRequestTokenResponse>

Defined in: src/client.ts:5347

Requests an email verification token for the purposes of registration. This API requests a token from the hub. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided.

Parameters and return value are as for requestEmailToken

string

As requestEmailToken

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestRegisterEmailToken


requestRegisterMsisdnToken(phoneCountry, phoneNumber, clientSecret, sendAttempt, nextLink?): Promise<IRequestMsisdnTokenResponse>

Defined in: src/client.ts:5375

Requests a text message verification token for the purposes of registration. This API requests a token from the hub. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided.

string

The ISO 3166-1 alpha-2 code for the country in which phoneNumber should be parsed relative to.

string

The phone number, in national or international format

string

As requestEmailToken

number

As requestEmailToken

string

As requestEmailToken

Promise<IRequestMsisdnTokenResponse>

Promise which resolves: As requestEmailToken

DigitalWorldClient.requestRegisterMsisdnToken


resendEvent(event, room): Promise<ISendEventResponse>

Defined in: src/client.ts:2505

Resend an event. Will also retry any to-device messages waiting to be sent.

DigitalWorldEvent

The event to resend.

Room

Optional. The room the event is in. Will update the timeline entry if provided.

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.resendEvent


resetNotifTimelineSet(): void

Defined in: src/client.ts:5248

Reset the notifTimelineSet entirely, paginating in some historical notifs as a starting point for subsequent pagination.

void

DigitalWorldClient.resetNotifTimelineSet


retryImmediately(): boolean

Defined in: src/client.ts:1913

Retry a backed off syncing request immediately. This should only be used when the user explicitly attempts to retry their lost connection. Will also retry any outbound to-device messages currently in the queue to be sent (retries of regular outgoing events are handled separately, per-event).

boolean

True if this resulted in a request being retried.

DigitalWorldClient.retryImmediately


roomInitialSync(roomId, limit): Promise<IRoomInitialSyncResponse>

Defined in: src/client.ts:7102

string

number

Promise<IRoomInitialSyncResponse>

Promise which resolves: TODO

DigitalWorldClient.roomInitialSync


roomState(roomId): Promise<IStateEventWithRoomId[]>

Defined in: src/client.ts:6920

string

Promise<IStateEventWithRoomId[]>

Promise which resolves: TODO

DigitalWorldClient.roomState


scrollback(room, limit?): Promise<Room>

Defined in: src/client.ts:4492

Retrieve older messages from the given room and put them in the timeline.

If this is called multiple times whilst a request is ongoing, the same Promise will be returned. If there was a problem requesting scrollback, there will be a small delay before another request can be made (to prevent tight-looping when there is no connection).

Room

The room to get older messages in.

number = 30

Optional. The maximum number of previous events to pull in. Default: 30.

Promise<Room>

Promise which resolves: Room. If you are at the beginning of the timeline, Room.oldState.paginationToken will be null.

DigitalWorldClient.scrollback


search(params, abortSignal?): Promise<ISearchResponse>

Defined in: src/client.ts:7898

Perform a server-side search.

ISearchRequestBody

the JSON object to pass to the request body.

string

the batch token to pass in the query string

AbortSignal

optional signal used to cancel the http request.

Promise<ISearchResponse>

Promise which resolves to the search response object.

DigitalWorldClient.search


searchMessageText(opts): Promise<ISearchResponse>

Defined in: src/client.ts:5629

ISearchOpts

Promise<ISearchResponse>

DigitalWorldClient.searchMessageText


searchRoomEvents(opts): Promise<ISearchResults>

Defined in: src/client.ts:5662

Perform a server-side search for room events.

The returned promise resolves to an object containing the fields:

  • count: estimate of the number of results
  • next_batch: token for back-pagination; if undefined, there are no more results
  • highlights: a list of words to highlight from the stemming algorithm
  • results: a list of results

Each entry in the results list is a SearchResult.

IEventSearchOpts

Promise<ISearchResults>

Promise which resolves: result object

DigitalWorldClient.searchRoomEvents


searchUserDirectory(options): Promise<IUserDirectoryResponse>

Defined in: src/client.ts:7290

Query the user directory with a term matching user IDs, display names and domains.

number

the maximum number of results to return. The server will apply a limit if unspecified.

string

the term with which to search.

Promise<IUserDirectoryResponse>

Promise which resolves: an array of results.

DigitalWorldClient.searchUserDirectory


sendEmoteMessage(roomId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3296

string

string

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendEmoteMessage

sendEmoteMessage(roomId, threadId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3297

string

string | null

string

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendEmoteMessage


sendEvent<K>(roomId, eventType, content, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:2716

Send a timeline event.

K extends keyof TimelineEvents

string

The room to send to.

K

The event type.

TimelineEvents[K]

The event content.

string

An optional ID to deduplicate requests in case of repeated attempts.

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendEvent

sendEvent<K>(roomId, threadId, eventType, content, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:2722

Send a timeline event.

K extends keyof TimelineEvents

string

The room to send to.

string | null

K

The event type.

TimelineEvents[K]

The event content.

string

An optional ID to deduplicate requests in case of repeated attempts.

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendEvent


sendHtmlEmote(roomId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3457

string

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlEmote

sendHtmlEmote(roomId, threadId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3458

string

string | null

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlEmote


sendHtmlMessage(roomId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3401

string

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlMessage

sendHtmlMessage(roomId, threadId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3402

string

string | null

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlMessage


sendHtmlNotice(roomId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3429

string

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlNotice

sendHtmlNotice(roomId, threadId, body, htmlBody): Promise<ISendEventResponse>

Defined in: src/client.ts:3430

string

string | null

string

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendHtmlNotice


sendImageMessage(roomId, url, info?, text?): Promise<ISendEventResponse>

Defined in: src/client.ts:3324

string

string

ImageInfo

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendImageMessage

sendImageMessage(roomId, threadId, url, info?, text?): Promise<ISendEventResponse>

Defined in: src/client.ts:3325

string

string | null

string

ImageInfo

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendImageMessage


sendMessage(roomId, content, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3210

string

RoomMessageEventContent

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to an ISendEventResponse object

DigitalWorldClient.sendMessage

sendMessage(roomId, threadId, content, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3211

string

string | null

RoomMessageEventContent

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to an ISendEventResponse object

DigitalWorldClient.sendMessage


sendNotice(roomId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3267

string

string

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

DigitalWorldClient.sendNotice

sendNotice(roomId, threadId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3268

string

string | null

string

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

DigitalWorldClient.sendNotice


sendReadReceipt(event, receiptType?, unthreaded?): Promise<EmptyObject | undefined>

Defined in: src/client.ts:3849

Send a read receipt.

DigitalWorldEvent | null

The event that has been read.

ReceiptType = ReceiptType.Read

other than ReceiptType.Read are experimental! Optional.

boolean = false

Promise<EmptyObject | undefined>

Promise which resolves: to an empty object {}

DigitalWorldClient.sendReadReceipt


sendReceipt(event, receiptType, body?, unthreaded?): Promise<EmptyObject>

Defined in: src/client.ts:3812

Send a receipt.

DigitalWorldEvent

The event being acknowledged

ReceiptType

The kind of receipt e.g. “m.read”. Other than ReceiptType.Read are experimental!

Record<string, any>

Additional content to send alongside the receipt.

boolean = false

An unthreaded receipt will clear room+thread notifications

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.sendReceipt


sendRtcDecline(roomId, notificationEventId): Promise<ISendEventResponse>

Defined in: src/client.ts:3920

string

string

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendRtcDecline


sendStateEvent(roomId, eventType, content, stateKey?): Promise<ISendEventResponse>

Defined in: src/embedded.ts:461

Send a state event into a room

string

ID of the room to send the event into

string

type of the state event to send

any

content of the event to send

string = ""

the stateKey to send into the room

Promise<ISendEventResponse>

Promise which resolves: TODO

DigitalWorldClient.sendStateEvent


sendStickerMessage(roomId, url, info?, text?): Promise<ISendEventResponse>

Defined in: src/client.ts:3360

string

string

ImageInfo

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendStickerMessage

sendStickerMessage(roomId, threadId, url, info?, text?): Promise<ISendEventResponse>

Defined in: src/client.ts:3366

string

string | null

string

ImageInfo

string

Promise<ISendEventResponse>

Promise which resolves: to a ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.sendStickerMessage


sendTextMessage(roomId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3240

string

string

string

Optional.

Promise<ISendEventResponse>

DigitalWorldClient.sendTextMessage

sendTextMessage(roomId, threadId, body, txnId?): Promise<ISendEventResponse>

Defined in: src/client.ts:3241

string

string | null

string

string

Optional.

Promise<ISendEventResponse>

DigitalWorldClient.sendTextMessage


sendToDevice(eventType, contentMap): Promise<EmptyObject>

Defined in: src/embedded.ts:611

Send an event to a specific list of devices. This is a low-level API that simply wraps the HTTP API call to send to-device messages. We recommend using queueToDevice() which is a higher level API.

string

type of event to send content to send. Map from user_id to device_id to content object.

SendToDeviceContentMap

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.sendToDevice


sendToDeviceViaWidgetApi(eventType, encrypted, contentMap): Promise<void>

Defined in: src/embedded.ts:655

Send an event to a specific list of devices via the widget API. Optionally encrypts the event.

If you are using a full DigitalWorldClient you would be calling ().encryptToDeviceMessages() followed by DigitalWorldClient.queueToDevice.

However, this is combined into a single step when running as an embedded widget client. So, we expose this method for those that need it.

string

Type of the event to send.

boolean

Whether the event should be encrypted.

SendToDeviceContentMap

The content to send. Map from user_id to device_id to content object.

Promise<void>


sendTyping(roomId, isTyping, timeoutMs): Promise<EmptyObject>

Defined in: src/client.ts:3980

string

boolean

number

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.sendTyping


setAccessToken(token): void

Defined in: src/client.ts:6495

Set the access token associated with this account.

string

The new access token.

void

DigitalWorldClient.setAccessToken


setAccountData<K>(eventType, content): Promise<EmptyObject>

Defined in: src/client.ts:2244

Set account data event for the current user, and wait for the result to be echoed over /sync.

Waiting for the remote echo ensures that a subsequent call to getAccountData will return the updated value.

If called before the client is started with startClient, logs a warning and falls back to setAccountDataRaw.

Retries the request up to 5 times in the case of an ConnectionError.

K extends keyof AccountDataEvents

K

The event type

Record<string, never> | AccountDataEvents[K]

the contents object for the event

Promise<EmptyObject>

DigitalWorldClient.setAccountData


setAccountDataRaw<K>(eventType, content): Promise<EmptyObject>

Defined in: src/client.ts:2296

Set account data event for the current user, without waiting for the remote echo.

K extends keyof AccountDataEvents

K

The event type

Record<string, never> | AccountDataEvents[K]

the contents object for the event

Promise<EmptyObject>

DigitalWorldClient.setAccountDataRaw


setAvatarUrl(url): Promise<EmptyObject>

Defined in: src/client.ts:4382

string

Promise<EmptyObject>

Promise which resolves: {} an empty object.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setAvatarUrl


setCanResetTimelineCallback(cb): void

Defined in: src/client.ts:6341

Set a function which is called when /sync returns a ‘limited’ response. It is called with a room ID and returns a boolean. It should return ‘true’ if the SDK can SAFELY remove events from this room. It may not be safe to remove events if there are other references to the timelines for this room, e.g because the client is actively viewing events in this room. Default: returns false.

ResetTimelineCallback

The callback which will be invoked.

void

DigitalWorldClient.setCanResetTimelineCallback


setDeviceDetails(deviceId, body): Promise<EmptyObject>

Defined in: src/client.ts:7685

Update the given device

string

device to update

body of request

string

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setDeviceDetails


setDisplayName(name): Promise<EmptyObject>

Defined in: src/client.ts:4365

string

Promise<EmptyObject>

Promise which resolves: {} an empty object.

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setDisplayName


setExtendedProfile(profile): Promise<void>

Defined in: src/client.ts:7539

Set multiple properties on your extended profile. This will completely replace the existing profile, removing any unspecified keys.

Record<string, unknown>

The profile object to set.

Promise<void>

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133 OR the server disallows editing the user profile.

DigitalWorldClient.setExtendedProfile


setExtendedProfileProperty(key, value): Promise<void>

Defined in: src/client.ts:7461

Set a property on your extended profile.

string

The key of the property to set.

unknown

The value to set on the property.

Promise<void>

https://github.com/tcpipuk/matrix-spec-proposals/blob/main/proposals/4133-extended-profiles.md

An error if the server does not support MSC4133 OR the server disallows editing the user profile.

DigitalWorldClient.setExtendedProfileProperty


setFallbackICEServerAllowed(allow): void

Defined in: src/client.ts:6035

Set whether to allow a fallback ICE server should be used for negotiating a WebRTC connection if the hub doesn’t provide any servers. Defaults to false.

boolean

void

DigitalWorldClient.setFallbackICEServerAllowed


setForceTURN(force): void

Defined in: src/client.ts:1737

Set whether VoIP calls are forced to use only TURN candidates. This is the same as the forceTURN option when creating the client.

boolean

True to force use of TURN servers

void

DigitalWorldClient.setForceTURN


setGuest(guest): void

Defined in: src/client.ts:1894

Set whether this client is a guest account. This method is experimental and may change without warning.

boolean

True if this is a guest account. if the token is a macaroon, it should be encoded in it that it is a ‘guest’ access token, which means that the SDK can determine this entirely without the dev manually flipping this flag.

void

DigitalWorldClient.setGuest


setGuestAccess(roomId, opts): Promise<void>

Defined in: src/client.ts:5308

Set r/w flags for guest access in a room.

string

The room to configure guest access in.

IGuestAccessOpts

Options

Promise<void>

Promise which resolves

DigitalWorldClient.setGuestAccess


setIdentityServerUrl(url?): void

Defined in: src/client.ts:6470

Set the identity server URL of this client

string

New identity server URL

void

DigitalWorldClient.setIdentityServerUrl


setIgnoredUsers(userIds): Promise<EmptyObject>

Defined in: src/client.ts:2385

Sets the users that the current user should ignore.

string[]

the user IDs to ignore

Promise<EmptyObject>

Promise which resolves: an empty object

DigitalWorldClient.setIgnoredUsers


setLivekitServiceURL(newURL): void

Defined in: src/client.ts:1816

string

void

DigitalWorldClient.setLivekitServiceURL


setLocalNotificationSettings(deviceId, notificationSettings): Promise<EmptyObject>

Defined in: src/client.ts:7791

Persists local notification settings

string

LocalNotificationSettings

Promise<EmptyObject>

Promise which resolves: an empty object

DigitalWorldClient.setLocalNotificationSettings


setMaxListeners(n): this

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:813

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

Returns a reference to the EventEmitter, so that calls can be chained.

number

this

v0.3.5

DigitalWorldClient.setMaxListeners


setNotifTimelineSet(set): void

Defined in: src/client.ts:1932

Set the global notification EventTimelineSet

EventTimelineSet

void

DigitalWorldClient.setNotifTimelineSet


setPassword(authDict, newPassword, logoutDevices?): Promise<EmptyObject>

Defined in: src/client.ts:7643

Make a request to change your password.

AuthDict

string

The new desired password.

boolean

Should all sessions be logged out after the password change. Defaults to true.

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setPassword


setPowerLevel(roomId, userId, powerLevel): Promise<ISendEventResponse>

Defined in: src/client.ts:2636

Set a power level to one or multiple users. Will apply changes atop of current power level event from local state if running & synced, falling back to fetching latest from the /state/ API.

string

the room to update power levels in

string | string[]

the ID of the user or users to update power levels of

number | undefined

the numeric power level to update given users to

Promise<ISendEventResponse>

Promise which resolves: to an ISendEventResponse object

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setPowerLevel


setPresence(opts): Promise<void>

Defined in: src/client.ts:4451

IPresenceOpts

Options to apply

Promise<void>

Promise which resolves

If ‘presence’ isn’t a valid presence enum value.

DigitalWorldClient.setPresence


setProfileInfo(info, data): Promise<EmptyObject>

Defined in: src/client.ts:4349

"avatar_url"

The kind of info to set (e.g. ‘avatar_url’)

The JSON object to set.

string

Promise<EmptyObject>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setProfileInfo

setProfileInfo(info, data): Promise<EmptyObject>

Defined in: src/client.ts:4350

"displayname"

The kind of info to set (e.g. ‘avatar_url’)

The JSON object to set.

string

Promise<EmptyObject>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setProfileInfo


setPusher(pusher): Promise<EmptyObject>

Defined in: src/client.ts:7764

Adds a new pusher or updates an existing pusher

IPusherRequest

Object representing a pusher

Promise<EmptyObject>

Promise which resolves: Empty json object on success

DigitalWorldClient.setPusher


setPushRuleActions(scope, kind, ruleId, actions): Promise<EmptyObject>

Defined in: src/client.ts:7876

Set the actions for a push notification rule.

string

PushRuleKind

string

PushRuleAction[]

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setPushRuleActions


setPushRuleEnabled(scope, kind, ruleId, enabled): Promise<EmptyObject>

Defined in: src/client.ts:7858

Enable or disable a push notification rule.

string

PushRuleKind

string

boolean

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setPushRuleEnabled


setPushRules(rules): void

Defined in: src/client.ts:7815

Update the push rules for the account. This should be called whenever updated push rules are available.

IPushRules

void

DigitalWorldClient.setPushRules


setRoomAccountData<K>(roomId, eventType, content): Promise<EmptyObject>

Defined in: src/client.ts:2611

K extends keyof RoomAccountDataEvents

string

the ID of the room this event should be stored within

K

event type to be set

Record<string, never> | RoomAccountDataEvents[K]

event content

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setRoomAccountData


setRoomDirectoryVisibility(roomId, visibility): Promise<EmptyObject>

Defined in: src/client.ts:7276

Set the visibility of a room in the current HS’s room directory

string

Visibility

“public” to make the room visible in the public directory, or “private” to make it invisible.

Promise<EmptyObject>

Promise which resolves: to an empty object {}

DigitalWorldClient.setRoomDirectoryVisibility


setRoomMutePushRule(scope, roomId, mute): Promise<void> | undefined

Defined in: src/client.ts:5555

Set a room-kind muting push rule in a room. The operation also updates DigitalWorldClient.pushRules at the end.

"global" | "device"

“global” or device-specific.

string

the id of the room.

boolean

the mute state.

Promise<void> | undefined

Promise which resolves: result object

DigitalWorldClient.setRoomMutePushRule


setRoomName(roomId, name): Promise<ISendEventResponse>

Defined in: src/client.ts:2545

string

string

Promise<ISendEventResponse>

Promise which resolves: TODO

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setRoomName


setRoomReadMarkers(roomId, rmEventId, rrEvent?, rpEvent?): Promise<EmptyObject>

Defined in: src/client.ts:3878

Set a marker to indicate the point in a room before which the user has read every event. This can be retrieved from room account data (the event type is m.fully_read) and displayed as a horizontal line in the timeline that is visually distinct to the position of the user’s own read receipt.

string

ID of the room that has been read

string

ID of the event that has been read

DigitalWorldEvent

the event tracked by the read receipt. This is here for convenience because the RR and the RM are commonly updated at the same time as each other. The local echo of this receipt will be done if set. Optional.

DigitalWorldEvent

the m.read.private read receipt event for when we don’t want other users to see the read receipts. This is experimental. Optional.

Promise<EmptyObject>

Promise which resolves: the empty object, {}.

DigitalWorldClient.setRoomReadMarkers


setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId?, rpEventId?): Promise<EmptyObject>

Defined in: src/client.ts:7122

Set a marker to indicate the point in a room before which the user has read every event. This can be retrieved from room account data (the event type is m.fully_read) and displayed as a horizontal line in the timeline that is visually distinct to the position of the user’s own read receipt.

string

ID of the room that has been read

string

ID of the event that has been read

string

ID of the event tracked by the read receipt. This is here for convenience because the RR and the RM are commonly updated at the same time as each other. Optional.

string

rpEvent the m.read.private read receipt event for when we don’t want other users to see the read receipts. This is experimental. Optional.

Promise<EmptyObject>

Promise which resolves: the empty object, {}.

DigitalWorldClient.setRoomReadMarkersHttpRequest


setRoomTag(roomId, tagName, metadata?): Promise<EmptyObject>

Defined in: src/client.ts:2581

string

string

name of room tag to be set

ITagMetadata = {}

associated with that tag to be stored

Promise<EmptyObject>

Promise which resolves: to an empty object

DigitalWorldClient.setRoomTag


setRoomTopic(roomId, topic?, htmlTopic?): Promise<ISendEventResponse>

Defined in: src/client.ts:2558

string

The room to update the topic in.

string

The plaintext topic. May be empty to remove the topic.

string

Optional.

Promise<ISendEventResponse>

Promise which resolves: TODO

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.setRoomTopic


setSupportsCallTransfer(support): void

Defined in: src/client.ts:1745

Set whether to advertise transfer support to other parties on calls.

boolean

True to advertise the ‘m.call.transferee’ capability

void

DigitalWorldClient.setSupportsCallTransfer


setSyncPresence(presence?): Promise<void>

Defined in: src/client.ts:4441

Specify the set_presence value to be used for subsequent calls to the Sync API. This has an advantage over calls to the PUT /presence API in that it doesn’t clobber status_msg set by other devices.

SetPresence

the presence to specify to set_presence of sync calls

Promise<void>

DigitalWorldClient.setSyncPresence


slidingSync(req, proxyBaseUrl?, abortSignal?): Promise<MSC3575SlidingSyncResponse>

Defined in: src/client.ts:8729

Perform a single MSC3575 sliding sync request.

MSC3575SlidingSyncRequest

The request to make.

string

The base URL for the sliding sync proxy.

AbortSignal

Optional signal to abort request mid-flight.

Promise<MSC3575SlidingSyncResponse>

The sliding sync response, or a standard error.

on non 2xx status codes with an object with a field “httpStatus”:number.

DigitalWorldClient.slidingSync


startClient(opts?): Promise<void>

Defined in: src/embedded.ts:295

High level helper method to begin syncing and poll for new events. To listen for these events, add a listener for ClientEvent.Event via DigitalWorldClient#on. Alternatively, listen for specific state change events.

IStartClientOpts = {}

Options to apply when syncing.

Promise<void>

DigitalWorldClient.startClient


stopClient(): void

Defined in: src/embedded.ts:364

High level helper method to stop the client from polling and allow a clean shutdown.

void

DigitalWorldClient.stopClient


stopPeeking(): void

Defined in: src/client.ts:5294

Stop any ongoing room peeking.

void

DigitalWorldClient.stopPeeking


storeClientOptions(): Promise<void>

Defined in: src/client.ts:6112

store client options with boolean/string/numeric values to know in the next session what flags the sync data was created with (e.g. lazy loading)

Promise<void>

for store operation

DigitalWorldClient.storeClientOptions


submitMsisdnToken(sid, clientSecret, msisdnToken, identityAccessToken): Promise<{ success: boolean; }>

Defined in: src/client.ts:8161

Submits a MSISDN token to the identity server

This is used when submitting the code sent by SMS to a phone number. The identity server has an equivalent API for email but the js-sdk does not expose this, since email is normally validated by the user clicking a link rather than entering a code.

string

The sid given in the response to requestToken

string

A secret binary string generated by the client. This must be the same value submitted in the requestToken call.

string

The MSISDN token, as entered by the user.

string | null

The access_token field of the Identity Server /account/register response (see registerWithIdentityServer). Some legacy identity servers had no authentication here.

Promise<{ success: boolean; }>

Promise which resolves: Object, containing success boolean.

Error if No identity server is set

DigitalWorldClient.submitMsisdnToken


submitMsisdnTokenOtherUrl(url, sid, clientSecret, msisdnToken): Promise<{ success: boolean; }>

Defined in: src/client.ts:8200

Submits a MSISDN token to an arbitrary URL.

This is used when submitting the code sent by SMS to a phone number in the newer 3PID flow where the hub validates 3PID ownership (as part of requestAdd3pidMsisdnToken). The hub response may include a submit_url to specify where the token should be sent, and this helper can be used to pass the token to this URL.

string

The URL to submit the token to

string

The sid given in the response to requestToken

string

A secret binary string generated by the client. This must be the same value submitted in the requestToken call.

string

The MSISDN token, as entered by the user.

Promise<{ success: boolean; }>

Promise which resolves: Object, containing success boolean.

DigitalWorldClient.submitMsisdnTokenOtherUrl


supportsIntentionalMentions(): boolean

Defined in: src/client.ts:8766

A helper to determine intentional mentions support

boolean

a boolean to determine if intentional mentions are enabled on the server

DigitalWorldClient.supportsIntentionalMentions


supportsThreads(): boolean

Defined in: src/client.ts:8757

A helper to determine thread support

boolean

a boolean to determine if threads are enabled

DigitalWorldClient.supportsThreads


supportsVoip(): boolean

Defined in: src/client.ts:1720

Check if the runtime environment supports VoIP calling.

boolean

True if VoIP is supported.

DigitalWorldClient.supportsVoip


supportUpdateState(): Promise<boolean>

Defined in: src/embedded.ts:290

Promise<boolean>


syncLeftRooms(): Promise<Room[]>

Defined in: src/client.ts:5770

Populate the store with rooms the user has left.

Promise<Room[]>

Promise which resolves: TODO - Resolved when the rooms have been added to the data store.

DigitalWorldClient.syncLeftRooms


timestampToEvent(roomId, timestamp, dir): Promise<TimestampToEventResponse>

Defined in: src/client.ts:8846

Find the event_id closest to the given timestamp in the given direction.

string

number

Direction

Promise<TimestampToEventResponse>

Resolves: A promise of an object containing the event_id and origin_server_ts of the closest event to the timestamp in the given direction

DigitalWorldClient.timestampToEvent


turnServer(): Promise<ITurnServerResponse>

Defined in: src/client.ts:5955

Promise<ITurnServerResponse>

Promise which resolves: ITurnServerResponse object

DigitalWorldClient.turnServer


unban(roomId, userId): Promise<EmptyObject>

Defined in: src/client.ts:4260

string

string

Promise<EmptyObject>

Promise which resolves: Object (currently empty)

DigitalWorldClient.unban


unbindThreePid(medium, address): Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Defined in: src/client.ts:7605

Unbind a 3PID for discovery on an identity server via the hub. The hub removes its record of the binding to keep an updated record of where all 3PIDs for the account are bound.

string

The threepid medium (eg. ‘email’)

string

The threepid address (eg. ‘bob@example.com’) this must be as returned by getThreePids.

Promise<{ id_server_unbind_result: IdServerUnbindResult; }>

Promise which resolves: on success

DigitalWorldClient.unbindThreePid


unstable_createLiveBeacon(roomId, beaconInfoContent): Promise<ISendEventResponse>

Defined in: src/client.ts:2684

Create an m.beacon_info event

string

MBeaconInfoEventContent

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.unstable_createLiveBeacon


unstable_setLiveBeacon(roomId, beaconInfoContent): Promise<ISendEventResponse>

Defined in: src/client.ts:2700

Upsert a live beacon event using a specific m.beacon_info.* event variable type

string

string

MBeaconInfoEventContent

Promise<ISendEventResponse>

May throw a DigitalWorldSafetyError if content is deemed unsafe.

DigitalWorldSafetyError

DigitalWorldClient.unstable_setLiveBeacon


unstableCreateFileTree(name): Promise<MSC3089TreeSpace>

Defined in: src/client.ts:8662

Creates a new file tree space with the given name. The client will pick defaults for how it expects to be able to support the remaining API offered by the returned class.

Note that this is UNSTABLE and may have breaking changes without notice.

string

The name of the tree space.

Promise<MSC3089TreeSpace>

Promise which resolves to the created space.

DigitalWorldClient.unstableCreateFileTree


unstableGetFileTreeSpace(roomId): MSC3089TreeSpace | null

Defined in: src/client.ts:8703

Gets a reference to a tree space, if the room ID given is a tree space. If the room does not appear to be a tree space then null is returned.

Note that this is UNSTABLE and may have breaking changes without notice.

string

The room ID to get a tree space reference for.

MSC3089TreeSpace | null

The tree space, or null if not a tree space.

DigitalWorldClient.unstableGetFileTreeSpace


upgradeRoom(roomId, newVersion, additionalCreators?): Promise<{ replacement_room: string; }>

Defined in: src/client.ts:6978

Upgrades a room to a new protocol version

string

string

The target version to upgrade to

string[]

an optional list of user IDs of users who should have the same permissions as the user performing the upgrade

Promise<{ replacement_room: string; }>

Promise which resolves: Object with key ‘replacement_room’

DigitalWorldClient.upgradeRoom


uploadContent(file, opts?): Promise<UploadResponse>

Defined in: src/client.ts:7313

Upload a file to the media repository on the hub.

XMLHttpRequestBodyInit

The object to upload. On a browser, something that can be sent to XMLHttpRequest.send (typically a File). Under node.js, a a Buffer, String or ReadStream.

UploadOpts

options object

Promise<UploadResponse>

Promise which resolves to response object, or rejects with an error (usually a DigitalWorldError).

DigitalWorldClient.uploadContent


uploadDeviceSigningKeys(auth?, keys?): Promise<EmptyObject>

Defined in: src/client.ts:8007

AuthDict

CrossSigningKeys

Promise<EmptyObject>

DigitalWorldClient.uploadDeviceSigningKeys


uploadKeySignatures(content): Promise<IUploadKeySignaturesResponse>

Defined in: src/client.ts:7924

KeySignatures

Promise<IUploadKeySignaturesResponse>

DigitalWorldClient.uploadKeySignatures


uploadKeysRequest(content, opts?): Promise<IKeysUploadResponse>

Defined in: src/client.ts:7920

Upload keys

IUploadKeysRequest

body of upload request

void

this method no longer takes any opts, used to take opts.device_id but this was not removed from the spec as a redundant parameter

Promise<IKeysUploadResponse>

Promise which resolves: result object. Rejects: with an error response (DigitalWorldError).

DigitalWorldClient.uploadKeysRequest


waitForClientWellKnown(): Promise<IClientWellKnown>

Defined in: src/client.ts:6099

Promise<IClientWellKnown>

DigitalWorldClient.waitForClientWellKnown


waitUntilRoomReadyForGroupCalls(roomId): Promise<void>

Defined in: src/client.ts:1831

Wait until an initial state for the given room has been processed by the client and the client is aware of any ongoing group calls. Awaiting on the promise returned by this method before calling getGroupCallForRoom() avoids races where getGroupCallForRoom is called before the state for that room has been processed. It does not, however, fix other races, eg. two clients both creating a group call at the same time.

string

The room ID to wait for

Promise<void>

A promise that resolves once existing group calls in the room have been processed.

DigitalWorldClient.waitUntilRoomReadyForGroupCalls


whoami(): Promise<IWhoamiResponse>

Defined in: src/client.ts:8836

Fetches information about the user for the configured access token.

Promise<IWhoamiResponse>

DigitalWorldClient.whoami


whoisSynapseUser(userId): Promise<ISynapseAdminWhoisResponse>

Defined in: src/client.ts:6071

Performs a whois lookup on a user using Synapse’s administrator API. This function is implementation specific and may change as a result.

string

the User ID to look up.

Promise<ISynapseAdminWhoisResponse>

the whois response - see Synapse docs for information.

DigitalWorldClient.whoisSynapseUser


static addAbortListener(signal, resource): Disposable

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:403

Listens once to the abort event on the provided signal.

Listening to the abort event on abort signals is unsafe and may lead to resource leaks since another third party with the signal can call e.stopImmediatePropagation(). Unfortunately Node.js cannot change this since it would violate the web standard. Additionally, the original API makes it easy to forget to remove listeners.

This API allows safely using AbortSignals in Node.js APIs by solving these two issues by listening to the event such that stopImmediatePropagation does not prevent the listener from running.

Returns a disposable so that it may be unsubscribed from more easily.

import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}

AbortSignal

(event) => void

Disposable

Disposable that removes the abort listener.

v20.5.0

DigitalWorldClient.addAbortListener


static getEventListeners(emitter, name): Function[]

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:325

Returns a copy of the array of listeners for the event named eventName.

For EventEmitters this behaves exactly the same as calling .listeners on the emitter.

For EventTargets this is the only way to get the event listeners for the event target. This is useful for debugging and diagnostic purposes.

import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}

EventEmitter<DefaultEventMap> | EventTarget

string | symbol

Function[]

v15.2.0, v14.17.0

DigitalWorldClient.getEventListeners


static getMaxListeners(emitter): number

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:354

Returns the currently set max amount of listeners.

For EventEmitters this behaves exactly the same as calling .getMaxListeners on the emitter.

For EventTargets this is the only way to get the max event listeners for the event target. If the number of event handlers on a single EventTarget exceeds the max set, the EventTarget will print a warning.

import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}

EventEmitter<DefaultEventMap> | EventTarget

number

v19.9.0

DigitalWorldClient.getMaxListeners


static listenerCount(emitter, eventName): number

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:297

A class method that returns the number of listeners for the given eventName registered on the given emitter.

import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2

EventEmitter

The emitter to query

string | symbol

The event name

number

v0.9.12

DigitalWorldClient.listenerCount


static on(emitter, eventName, options?): AsyncIterator<any[]>

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:270

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here

Returns an AsyncIterator that iterates eventName events. It will throw if the EventEmitter emits 'error'. It removes all listeners when exiting the loop. The value returned by each iteration is an array composed of the emitted event arguments.

An AbortSignal can be used to cancel waiting on events:

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());

Use the close option to specify an array of event names that will end the iteration:

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'

EventEmitter

string | symbol

StaticEventEmitterIteratorOptions

AsyncIterator<any[]>

An AsyncIterator that iterates eventName events emitted by the emitter

v13.6.0, v12.16.0

DigitalWorldClient.on

static on(emitter, eventName, options?): AsyncIterator<any[]>

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:275

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here

Returns an AsyncIterator that iterates eventName events. It will throw if the EventEmitter emits 'error'. It removes all listeners when exiting the loop. The value returned by each iteration is an array composed of the emitted event arguments.

An AbortSignal can be used to cancel waiting on events:

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());

Use the close option to specify an array of event names that will end the iteration:

import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'

EventTarget

string

StaticEventEmitterIteratorOptions

AsyncIterator<any[]>

An AsyncIterator that iterates eventName events emitted by the emitter

v13.6.0, v12.16.0

DigitalWorldClient.on


static once(emitter, eventName, options?): Promise<any[]>

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:184

Creates a Promise that is fulfilled when the EventEmitter emits the given event or that is rejected if the EventEmitter emits 'error' while waiting. The Promise will resolve with an array of all the arguments emitted to the given event.

This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event semantics and does not listen to the 'error' event.

import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}

The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the ’error' event itself, then it is treated as any other kind of event without special handling:

import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom

An AbortSignal can be used to cancel waiting for the event:

import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!

EventEmitter

string | symbol

StaticEventEmitterOptions

Promise<any[]>

v11.13.0, v10.16.0

DigitalWorldClient.once

static once(emitter, eventName, options?): Promise<any[]>

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:189

Creates a Promise that is fulfilled when the EventEmitter emits the given event or that is rejected if the EventEmitter emits 'error' while waiting. The Promise will resolve with an array of all the arguments emitted to the given event.

This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event semantics and does not listen to the 'error' event.

import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}

The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the ’error' event itself, then it is treated as any other kind of event without special handling:

import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom

An AbortSignal can be used to cancel waiting for the event:

import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!

EventTarget

string

StaticEventEmitterOptions

Promise<any[]>

v11.13.0, v10.16.0

DigitalWorldClient.once


static setMaxListeners(n?, …eventTargets): void

Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:369

import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);

number

A non-negative number. The maximum number of listeners per EventTarget event.

…(EventEmitter<DefaultEventMap> | EventTarget)[]

Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects.

void

v15.4.0

DigitalWorldClient.setMaxListeners