Hello,
I'm trying to send data via the Octoprint Javascript Client Library to a custom plugin,
but I'm not sure how to do that.
My guess was to either use OctoPrint.socket.sendMessage
with the new custom events,
so for example in the plugin itself:
def register_custom_events(self, *args, **kwargs):
return ["selectExtruder"]
and then using OctoPrint.socket.sendMessage("octoprint.events.Events.PLUGIN_MYPLUGINNAME_LIGHT", "ON")
and reacting on the plugin side with
self.onDataUpdaterPluginMessage = function(plugin, data) {...}
This did not work, no message was sent to onDataUpdaterPluginMessage at all.
My other guess was almost the same, but not using register_custom_events and instead just send it via
OctoPrint.socket.sendMessage("mypluginname", {type: "light", "data": "ON"})
using the same name as if I was sending data from the plugin itself like self._plugin_manager.send_plugin_message(self._identifier, dict(type=myType, data=myData))
Though that did not register any message sent either.
Does someone has an idea how I can achieve this?
Or would it be possible to include in OctoPrint itself so I can send data on the custom event channel from the JS Library to the plugin?