Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Resubscribe on client disconnection throws an exception #4

@MonkeyDo

Description

@MonkeyDo

Hi,
When using the resubscribe option (which I believe is default behavior), I get an exception throw when a client disconnects and reconnects.
The error is throw on this line: https://github.com/boneskull/mqttletoad/blob/master/lib/index.js#L59
The 'topic' argument passed is not a string but an object instead, and no listener argument is passed.

This is called by MQTT.js upon reconnection (I believe that is a result of monkey-patching the subscribe function):
https://github.com/mqttjs/MQTT.js/blob/master/lib/client.js#L215
The only argument passed is a dictionnary of topics we were previously subscribed to.

Since I'm not calling that function, I can't catch the exception properly to handle it, and the MQTT part of my application stops working altogether.

Disabling resubscriptions is not really an option for me. Perhaps I can help sort out resubscriptions with your library? Does toad keep its own dictionnary of subscribed topics and associated listeners?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions