Closed vera closed 3 years ago
Hi, When the REGISTER sent by a gateway is rejected, there’s no way to fix the negotiation. TopicIds are created by the gateway not by the clients. TopicIds sent by the gateway is always valid. So, there’s two choices, one is discarding a PUBLISh message from a broker. The other is sending PUBLISH in any case. I think we should involve more people to discuss about this issue. @icraggs, how do you think about this.
Hi,
When the gateway receives a PUBLISH message from the broker that matches the wildcard topic, it sends a REGISTER to the client before sending the PUBLISH. The TopicId is always uniquely determined by the gateway. Therefore, if the REGACK response is TOPICID_INVALID, the gateway considers the client unable to receive the message and discards the PUBLISH message.
I fix it like this.
Hi, Section 6.10 of the specification mention about this issue. The GW will wait for the REGACK message before it sends the PUBLISH message to the client. If the client receives a PUBLISH message with unkown topic id value, it sshall responde with a PUBACK message with the ReturnCode="Rejected:invalid Topic ID".
So, I will revert c65d66e
Wireshark trace:
(Port 10000 is the gateway, 10001 is the MQTT-SN client)
Is this the intended behaviour?
In this case, the topic ID is rejected due to an error in my client, but I think in any case the PUBLISH should not be sent until a topic ID was successfully registered.