Open ctron opened 3 years ago
Yeah, MQTT topic filters are a very important feature, look at the source implementation, it doesn't seem to do this specifically, right?
@ctron would you like to contribute?
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.
Hi @vietj i would like to contribute. Let me know what is the process.
MqttClientImpl Class.
@Override
public Future
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.
you can read these
happy to have a PR @SivaAkiro
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.