eclipse-paho / eclipse-paho/paho.mqtt.javascript

It would be nice if subscribe allowed to define own onMessageArrived handler for subscribed topic.

Open
#192 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

I'm building a web client to **node-red** where I'm running **mosca MQTT broker**.

I'd like to be able to `subscribe` in the UI client to various topics and process subscribed messages locally within each UI module rather than worry about dispatching them from a shared `mqtt.onMessageArrived` handler.
Perhaps adding an `onMessageArrived` option to the `subscribe` call would make sense for this?
Internally, Paho.MQTT would route incoming messages to that handler if the topic matches subscription filter.

Or, subscribe could return a mediator object that would have its own `onMessageArrived `handler as well as publish method, which would automatically set the topic based on the subscription? However, this may be an overkill and a problem if subscription uses wildcards.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.