Unable to unsubscribe from multiple topics at once
Opened this issue · 6 comments
ctron commented
Describe the feature
Currently there is an unsubscribe method, which only allows to unsubscribe from a single topic. However, with MQTT you can unsubscribe from multiple topic filters at the same time.
Use cases
Unsubscribe from multiple topics, in a single message.
chenzhiguo commented
Yeah, MQTT topic filters are a very important feature, look at the source implementation, it doesn't seem to do this specifically, right?
tsegismont commented
@ctron would you like to contribute?
ctron commented
I could draft up a PR. However I am not sure I can find the time to follow up on this to get it merged. I think this should come from the project.
SivaAkiro commented
MqttClientImpl Class.
@OverRide
public Future unsubscribe(List topics) {
MqttFixedHeader fixedHeader = new MqttFixedHeader(
MqttMessageType.UNSUBSCRIBE,
false,
AT_LEAST_ONCE,
false,
0);
MqttMessageIdVariableHeader variableHeader = new MqttMessageIdAndPropertiesVariableHeader(
nextMessageId(), MqttProperties.NO_PROPERTIES);
MqttUnsubscribePayload payload = new MqttUnsubscribePayload(topics);
io.netty.handler.codec.mqtt.MqttMessage unsubscribe = MqttMessageFactory.newMessage(fixedHeader,
variableHeader, payload);
this.write(unsubscribe);
return ctx.succeededFuture(variableHeader.messageId());
}
Changed the corresponding other classes also.
Tested the same with sample server and client.
vietj commented