You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.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?
The text was updated successfully, but these errors were encountered:
@lujiashun1 As far as I understand your problem, you want to avoid duplicate subscribtions.
So what can you do is to create some hash map and store there what topics have been subscibed already and before making new sub you just will check if you haven't already subscribed.
PS. Use lock statement that no parallel clicks subscibe to one topic twice.
MqttTest.zip
`var mqttSubscribeOptions = mqttFactory.CreateSubscribeOptionsBuilder()
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?
The text was updated successfully, but these errors were encountered: