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

(un)subscribed signal does not pass topic any more #98

Closed
ejvr opened this issue Jun 28, 2017 · 3 comments
Closed

(un)subscribed signal does not pass topic any more #98

ejvr opened this issue Jun 28, 2017 · 3 comments

Comments

@ejvr
Copy link
Contributor

ejvr commented Jun 28, 2017

The subscribe signal in QMQTT::Client still has a topic argument, but it will always be an empty string. Apparently the topic is not passed in the SUBACK message (See ClientPrivate::onNetworkReceived). The same goes for the unsubscribed signal.

Personally I do not have problems with this (not using the signals anyway), but I guess it may confuse people. Wouldn't it be better to remove the topic variable from the signals? The Client interface was already changed with pull request #96 which introduced the issue, so it seems OK to change it once more.

@mwallnoefer
Copy link
Collaborator

Good catch! I think it would be better to re-introduce the topic, so that we save it in a member variable. Of course it should be done only if it does not complicate our code too much.

@emqtt/qmqtt-team What do you think?

@ejvr
Copy link
Contributor Author

ejvr commented Jul 1, 2017

This could be fixed by introducing a message ID -> topic lookup in the ClientPrivate class. Upon a (un)subscribe we add the message ID/topic combination to the lookup. When the (UN)SUBACK arrives we can recover the topic using the message ID in the message.

This would be a simple fix which would change the ClientPrivate class only. It just tried it and it seemed to work (with mosquitto as the broker). If you want, I can create a pull request with the change.

@mwallnoefer
Copy link
Collaborator

@ejvr Yes please, I am eager to accept your marvelous contributions.

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

2 participants