aciidgh / SwiftMQTT

MQTT Client in pure swift ❤️
MIT License
270 stars 71 forks source link

Username & Password connection #55

Closed AndreGloria closed 3 years ago

AndreGloria commented 4 years ago

According to the MQTTSession file it is possible to use username and password to authenticate, but the initializer for the MQTTSession don't accept those fields.

How can I start a connection using username authetication?

geberl commented 4 years ago
mqttSession = MQTTSession(
    host: "192.168.1.23",
    port: 1883,
    clientID: "",
    cleanSession: true,
    keepAlive: 50,
    useSSL: false
)
mqttSession.username = "john-doe"
mqttSession.password = "super-secret"

mqttSession.connect { error in
...