publish( )


Publishes a message to a channel or resource.

The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.

Authentication

This method may require higher-level permissions than the caller has, based on their identity and roles and permissions. In these cases, you can ensure the method is called with the required level of authorization by using elevated permissions.

Permissions
Publish Realtime Messages
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
channelPublishChannelRequired

Channel and resource to publish to.


payloadRecord<string, any>Required

Message payload. Max: 10 KB.

Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?