Skip to main content

Frequently Asked Questions

Here are some frequently asked questions about the Plugin SDK.

What is the difference between DytePlugin.init() and DytePlugin.ready()?

plugin.init() is called to initialise the plugin and plugin.ready() is called when the plugin is ready to emit and receive events from the client app. Usually these events occur one after the other and the user need not manually call plugin.ready().

plugin.ready() can be manually used to control when this communication starts.

import DytePlugin from "@dytesdk/plugin-sdk";
...
const plugin = await DytePlugin.init({ready: false});

// .. do something

plugin.ready();

When are participant related events fired?

Peer events like peerLeft and peerJoined are only fired for when another participant leaves/joins the meeting, not for the current user.

These events can be called like so.

import DytePlugin from "@dytesdk/plugin-sdk";
...
const plugin = await DytePlugin.init();

plugin.on('peerJoined', (peer) => {
console.log(peer);
});

plugin.on('peerLeft', (peer) => {
console.log(peer);
});