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

how to unsubscibe all topics #2063

Open
lujiashun1 opened this issue Aug 15, 2024 · 1 comment
Open

how to unsubscibe all topics #2063

lujiashun1 opened this issue Aug 15, 2024 · 1 comment
Labels
question It is a question regarding the project

Comments

@lujiashun1
Copy link

lujiashun1 commented Aug 15, 2024

MqttTest.zip
github
`var mqttSubscribeOptions = mqttFactory.CreateSubscribeOptionsBuilder()

            .Build();
        //MqttClientUnsubscribeOptions mqttClientUnsubscribeOptions = new MqttClientUnsubscribeOptions();
        //mqttClientUnsubscribeOptions.TopicFilters = mqttClient.Options.
        //await mqttClient.UnsubscribeAsync(mqttClientUnsubscribeOptions);
        mqttSubscribeOptions.TopicFilters = mqttTopicFilters;


        var response = await mqttClient.SubscribeAsync(mqttSubscribeOptions, CancellationToken.None);`

when I click Subscribe several times,I received several identical messages at the same time, Can't it remove duplicate topics,or how to unsbuscribe all topics?

@lujiashun1 lujiashun1 added the question It is a question regarding the project label Aug 15, 2024
@SeppPenner
Copy link
Collaborator

You can subsribe to the same topic multiple times if you want, but you shouldn't. And you can unsubscribe using UnsubscribeAsync, so what's the point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question It is a question regarding the project
Projects
None yet
Development

No branches or pull requests

2 participants