Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

subscribe(filter, messageHandler, id, contextName)

Updated on July 20, 2021

Subscribes to the messaging service and forwards messages to subscribers based on a specified filter criteria.


The user-assigned or auto-generated subscription ID as a string.


filterobjectThe object containing the filter criteria.
messageHandlerfunctionThe callback function that needs to be invoked.
idstringThe user-assigned or auto-generated unique identifier of the subscriber to whom the messages can be forwarded.
contextNamestringThe name of the context where the API is being called.

Usage example

In this example, the API subscribes to the messaging service and forwards the messages to subscribers based on the specified filter criteria.

Example usage - PCore.getMessagingServiceManager().subscribe({matcher: "interaction"}, message => {
 // Perform message execution here

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us