Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket connection lost on message received with QOS2 subscription. #40

Open
phlegx opened this issue Jan 24, 2022 · 0 comments
Open

Socket connection lost on message received with QOS2 subscription. #40

phlegx opened this issue Jan 24, 2022 · 0 comments

Comments

@phlegx
Copy link

phlegx commented Jan 24, 2022

Hi!

I use the latest version of the library (master). For tests I use test.mosquitto.org as MQTT broker. Here my code:

mqttc.subscribe((const char *)"TEST/device/+", MQTT::QOS2, cbFunc);

void cbFunc(MQTT::MessageData &md) {
    MQTT::Message &msg = md.message;
    printf("MQTT: qos %d, retained %d, dup %d, packetid %d", msg.qos, msg.retained, msg.dup, msg.id);
    printf("Payload %.*s", msg.payloadlen, (char*)msg.payload);
}

After sending a message to the client:

$ mosquitto_pub -h test.mosquitto.org -p 8883 -t "TEST/device/1" -m "Hi!" --cafile ./mosquitto.org.crt -q 2 -d
Client mosq-picrhde0TAJrbDyccL sending CONNECT
Client mosq-picrhde0TAJrbDyccL received CONNACK (0)
Client mosq-picrhde0TAJrbDyccL sending PUBLISH (d0, q2, r0, m1, 'TEST/device/1', ... (3 bytes))
Client mosq-picrhde0TAJrbDyccL received PUBREC (Mid: 1)
Client mosq-picrhde0TAJrbDyccL sending PUBREL (m1)
Client mosq-picrhde0TAJrbDyccL received PUBCOMP (Mid: 1, RC:0)
Client mosq-picrhde0TAJrbDyccL sending DISCONNECT

the socket connection of the mbed-mqtt client is lost. If I send a message with QOS1 or QOS0 there are no problems and all woks as expected (no socket connection lost).

Is this a bug in the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant