linkMessageReceivers

fun linkMessageReceivers(messageReceiverParent: Any, pubSub: PortalsPubSub = PortalsPubSub.shared)

Link a class with methods decorated with the PortalMethod annotation to use as Portals message receivers.

The name of the method should match the message name used to send messages via the Portal. Alternatively the PortalMethod annotation topic property can be used to designate a different name. The registered methods should accept a single String representing the payload of a message sent through the Portal.

An instance of PortalsPubSub can be provided to override the default behavior of publishing events through PortalsPubSub.shared.

Parameters

messageReceiverParent

a class that contains PortalMethod annotated functions

pubSub

an instance of PortalsPubSub. Defaults to PortalsPubSub.shared.