emqx / CocoaMQTT

MQTT 5.0 client library for iOS and macOS written in Swift
https://www.emqx.com/en
Other
1.59k stars 418 forks source link

Qos not respected on subscription #445

Closed rafaelnobrekz closed 2 years ago

rafaelnobrekz commented 2 years ago

Hi! Starting to know the library, I noticed that qos1 is hardcoded on MqttSubscription? Does this make sense ?

public func subscribe(_ topic: String, qos: CocoaMQTTQoS = .qos1) {
        let filter = MqttSubscription(topic: topic)
        return subscribe([filter])
    }
leeway1208 commented 2 years ago

It's OK, It's swift syntax to set default values.

rafaelnobrekz commented 2 years ago

Hi, what I mean is the qos variable is not injected into MqttSubscription object thus what we set is completely ignored

leeway1208 commented 2 years ago

haha. you are right. I will fix it.

rafaelnobrekz commented 2 years ago

Cool, thanks! I could have made a PR, but I thought maybe I was missing something 🤪