Or, more directly within Perspective, you can use the
com.inductiveautomation.perspective.gateway.api.ComponentModelDelegateRegistry#get) to register custom Java code that will be ‘attached’ to each instance of your component.
com.inductiveautomation.perspective.gateway.api.ComponentModelDelegate you’ll see hooks to both send and receive messages from the frontend. On the frontend, you’d call an event via the
componentEvents instance in your component’s
The payload can be whatever you want; it’ll be automatically marshalled to JSON and sent to the backend component.