Skip to content

API - Messages

Allows messages to be passed between remote instances of your plugin running on other users' devices.

When extending BasePlugin, these functions can be accessed via this.messages.*

When extending BaseComponent, these functions can be accessed via this.plugin.messages.*

Functions

send(msg, isGlobal=false, targetUserID='')

Send a message to all instances of your plugin.

All running instances will receive this in the onMessage(data) method inside the plugin.

Field Type Description Example
msg string Message to send 'random-color'
isGlobal boolean true to send to everyone on the entire server, false to only send to everyone within rendering range true
targetUserID string Identifier of the user you would like to send to ''

request(msg, isGlobal=false, targetUserID='') : Promise<boolean>

Send a request to all instances of your plugin.

The first truthy value is returned. All running instances will receive the request in the plugin class' onRequest(data) function.

Field Type Description Example
msg string Request to send 'random-color'
isGlobal boolean true to send to everyone on the entire server, false to only send to everyone within rendering range true
targetUserID string Identifier of the user you would like to send to ''
Back to top