Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate subscriptions being made #191

Open
iprak opened this issue Jan 17, 2019 · 0 comments
Open

Duplicate subscriptions being made #191

iprak opened this issue Jan 17, 2019 · 0 comments

Comments

@iprak
Copy link

iprak commented Jan 17, 2019

The config values for SUFFIX_COMMAND and SUFFIX_WRITE_STATE are empty string by default, this causes handleSubscribeEvent to add duplicate subscriptions. I think we can just can just make one subscription if getTopicFor value is the same?

function handleSubscribeEvent (req, res) {
    // Subscribe to all events
    subscriptions = [];
    Object.keys(req.body.devices).forEach(function (property) {
        req.body.devices[property].forEach(function (device) {
            subscriptions.push(getTopicFor(device, property, TOPIC_COMMAND));
            subscriptions.push(getTopicFor(device, property, TOPIC_WRITE_STATE));
        });
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant