Skip to content

Separate callback for each subscribe call like Aedes.subscribe()  #1951

Open
@nolimitdev

Description

@nolimitdev

Is your feature request related to a problem? Please describe.
I'm always frustrated when I subscribe to more topics and must find correct message in shared callback on.message using very long switch or if/elseif.

Describe the solution you'd like
I would like to have ability to call subscribe with one topic (can include + and #) and separate callback. Exactly like npm aedes has... Aedes has this feature and it is great because supports + and # https://github.com/moscajs/aedes/blob/HEAD/docs/Aedes.md#aedessubscribe-topic-deliverfunc-callback Im very missing something like this in npm mqtt package.

Maybe it could be easy implemented by looking for source code of aedes. Also Chat GPT suggest good looking idea how to compare subscribe pattern with received message without regexp and run appropriate subscription callback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions