Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

Invalid QOS when publishing data #14

@pavb74

Description

@pavb74

I want to publish data with QOS=1 because my messaging service (RabbitMQ) doesn't support QOS=2. The QOS parameter is not correctly parsed and the QOS is always set to 2 whatever the value put in parameter.

It seems to come from the publish method of Mqtt.m and the conversion of the QOS attribute from Number to MQTTQosLevel. When I add a pre conversion to an unsigned int it works.

// Before

  • (void) publish:(NSString *) topic data:(NSData *)data qos:(NSNumber *)qos retain:(BOOL) retain {
    [self.manager sendData:data
    topic:topic
    qos:(MQTTQosLevel)qos
    retain:retain];
    //[data dataUsingEncoding:NSUTF8StringEncoding]
    }

// After

  • (void) publish:(NSString *) topic data:(NSData *)data qos:(NSNumber *)qos retain:(BOOL) retain {
    [self.manager sendData:data
    topic:topic
    qos:(MQTTQosLevel)[qos unsignedIntValue]
    retain:retain];
    //[data dataUsingEncoding:NSUTF8StringEncoding]
    }

Is it possible to re-integrate this fix please?

Thanks

PA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions