snipsco/hermes-protocol

Simple publish

oziee opened this issue · 2 comments

oziee commented

Allow for users to publish using the connected Hermes mqtt object with their own topic with message, external to the “Hermes” topics

Just because the incoming intent is snips, some intent code that reacts might want to send a topic to an IoT device
hermes/intent/my:intenttv
Now the react code needs to publish mytopics/tv/function {on}

But we don’t want to have to create another mqtt connection when the Hermes object is already connected to the broker

Hi @oziee

I don't think this is a good idea, for multiple reasons.

  • hermes in itself is MQTT agnostic, the implementation we use the most is indeed the MQTT one at the moment but we also have an inprocess version for which this doesn't make any sense
  • I don't want to end up maintaining a generic MQTT client API in this lib, there are already better ones in all the languages we support and adding this here will add some maintenance cost that would be better spent elsewhere
  • creating a new connection to the broker is not that expensive: networkwise it is only 2 small packets every few seconds for the pings when nothing is posted on it, which is nothing compared to the rest of the platform (say for example the sound input)

pity

snippets can't use the hermes mqtt client that is already connected. Snippets receive intent notifications.. but can't send mqtt except specific snips hermes mqtt topics

I hardy see any problem in adding a few lines of code that allow for access to the ffi connected mqtt client to publish -topic-message