Skip to main content

Other methods

Send data to the plugin

You can send data (type any) to a plugin using the sendData() method. This method comes in handy when building your own plugin.

let pluginId = "..."
if let plugin = meeting.plugins.active.first(where: { $0.id == pluginId }) {
plugin.sendData(eventName: "my-custom-event", data: "Hello world")
}

Receive data from the plugin

You can receive data from a plugin by implementing the methods defined in DytePluginEventsListener interface. This method comes in handy when building your own plugin. Listen Plugin events using meeting.addPluginEventsListener(meetingViewModel)

extension MeetingViewModel: DytePluginEventsListener {
func onPluginActivated(plugin: DytePlugin) {
...
}

func onPluginDeactivated(plugin: DytePlugin) {
...
}

func onPluginMessage(plugin: DytePlugin, eventName: String, data: Any?) {
...
}

func onPluginFileRequest(plugin: DytePlugin) {
...
}
}