1

I know how to connect to broker by hbmqtt in script bash:

 hbmqtt_sub --url mqtt://guest:guest@localhost:15672 -t a/b

but in my code where i use hbmqtt library how can I set username and password

async def test_sub():
    client = MQTTClient()
    await client.connect(' mqtt://guest:guest@localhost:15672')
    await client.subscribe([
        ('a/b', QOS_1),
    ])

this code doesnt work!

zr0gravity7
  • 2,917
  • 1
  • 12
  • 33

0 Answers0