Skip to main content

Methods

Initialize

This method initializes the SDK and returns a plugin object. The Client SDK (web/mobile) receives a ready event once the initialisation is complete.

the ready event signifies that the plugin is now ready for event/data exchange.

const plugin = await DytePlugin.init();

Initialize without data exchange

This method initializes the SDK without emitting a ready event to the client SDK. The user can choose to manually emit this later when the plugin is ready to start event/data exchange with client SDK.

const plugin = await DytePlugin.init({ ready: false });
// do something ...
plugin.ready();

Methods specific to staggered plugins

Before you start

Staggered plugins are plugins that are enabled only for specific users. By default these are only enabled for the user that opens them.

Enable plugin for all users

await plugin.enableForAll();

Enable plugin for specific users

ParamTypeDescriptionDefault ValueRequired
peerIdsstring[]List of peer IDs for which plugin has to be enabled.-false
const peerIds: string[] = ['...'];
await plugin.enableForPeers(peerIds);

Disable plugin for all users

await plugin.disableForAll();

Disable plugin for specific users

ParamTypeDescriptionDefault ValueRequired
peerIdsstring[]List of peer IDs for which plugin has to be disabled.-false
const peerIds: string[] = ['...'];
await plugin.disableForPeers(peerIds);