simple mqtt client not working
- 
					
					
					
					
 Trying to run simple mqtt example but always get error at 140 of mqtt.py ♦Traceback (most recent call last): 
 File "<stdin>", line 14, in <module>
 File "/flash/lib/mqtt.py", line 140, in subscribe
 TypeError: function missing 1 required positional argumentsstruct.pack_into("!BH", pkt, 1, 2 + 2 + len(topic) + 1, self.pid) #print(hex(len(pkt)), hexlify(pkt, ":")) self.sock.write(pkt) self._send_str(topic) self.sock.write(qos.to_bytes(1)) # LINE 140 while 1: op = self.wait_msg() if op == 0x90: resp = self.sock.read(4)
 
- 
					
					
					
					
 @st3vev thx so much. This should really be mentioned in the tutorial. I also think that this polling needs to be activated automatically once a subscribe happens. 
 
- 
					
					
					
					
 thanks its working now 
 
- 
					
					
					
					
 @misterlisty The tutorial is broken. You have to manually check for new messages. I created another PR for the tutorial: https://github.com/pycom/pycom-documentation/pull/15 
 
- 
					
					
					
					
 This is my mqtt main.py which sends msg ok but the subscribe is not returning anything? ANyone see anything wrong? from network import WLAN 
 from mqtt import MQTTClient
 import machine
 import timeprint("Setup::event") 
 def sub_cb(topic, msg):
 print("mqtt::",topic,"msg[",msg,"]")print("Connected to Wifi\n") 
 client = MQTTClient("demo", "test.smallbiz.com.au", port=1883)
 client.settimeout = 10000
 client.set_callback(sub_cb)
 client.connect()
 client.subscribe(topic="lopy01/inbox")while True: 
 print("Sending ON")
 client.publish("lopy01/outbox/", "ON")
 time.sleep(1)
 print("Sending OFF")
 client.publish("lopy01/outbox/", "OFF")
 time.sleep(1)
 
- 
					
					
					
					
 Hey... I had a same issue and it was fairly simple to fix it. 
 I've created a pull request to the GitHub repo (https://github.com/pycom/pycom-libraries/pull/36) so you can check what is changed.
 I'll struggle with the CLA agreement tomorrow to make the PR mergeable.
 
