Skip to content

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

Open
@phlegx

Description

@phlegx

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions