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
I use this component as a broker, and use the eclipse paho client receive message from broker.
I found that using the MqttEndpoint publish method to send messages to clients, regardless of whether the QoS is 0 or not, each time it get the next message ID. But if paho client receive a message with QoS 0, its message ID is 0.
MqttPublishVariableHeader variableHeader =
new MqttPublishVariableHeader(topic, this.nextMessageId());
I write an example, one client send a message with QoS 0 and next time send a message with QoS 1 to the other, loop this function 10 times.
for (int i = 0; i < 10; ++i) {
mqttClient.publish(testTopic, "hello".getBytes(), 0, false);
mqttClient.publish(testTopic2, "world".getBytes(), 1, false);
}
the receive client console log:
mqtt client is connected.
----connect complete-----
false : tcp://127.0.0.1:1886
message id = 0, qos = 0, payload = hello
1
message id = 2, qos = 1, payload = world
2
message id = 0, qos = 0, payload = hello
3
message id = 4, qos = 1, payload = world
4
message id = 0, qos = 0, payload = hello
5
message id = 6, qos = 1, payload = world
6
message id = 0, qos = 0, payload = hello
7
message id = 8, qos = 1, payload = world
8
message id = 0, qos = 0, payload = hello
9
message id = 10, qos = 1, payload = world
10
message id = 0, qos = 0, payload = hello
11
message id = 12, qos = 1, payload = world
12
message id = 0, qos = 0, payload = hello
13
message id = 14, qos = 1, payload = world
14
message id = 0, qos = 0, payload = hello
15
message id = 16, qos = 1, payload = world
16
message id = 0, qos = 0, payload = hello
17
message id = 18, qos = 1, payload = world
18
message id = 0, qos = 0, payload = hello
19
message id = 20, qos = 1, payload = world
20
I think it's necessary to add a judgment on QoS in the publish method to prevent the client from receiving discontinuous message IDs.
The text was updated successfully, but these errors were encountered:
I use this component as a broker, and use the eclipse paho client receive message from broker.
I found that using the MqttEndpoint publish method to send messages to clients, regardless of whether the QoS is 0 or not, each time it get the next message ID. But if paho client receive a message with QoS 0, its message ID is 0.
I write an example, one client send a message with QoS 0 and next time send a message with QoS 1 to the other, loop this function 10 times.
the receive client console log:
I think it's necessary to add a judgment on QoS in the publish method to prevent the client from receiving discontinuous message IDs.
The text was updated successfully, but these errors were encountered: