Page 1 of 1

umqtt/usocket questions

Posted: Thu Mar 09, 2017 5:49 am
by skimj
I'm using version 1.8.7 on an ESP8266 board. I have a couple of questions about umqtt and usocket:

1. Would it be safe to use umqtt.simple.ping() in a timer callback? The umqtt ping function is simply `self.sock.write(b"\xc0\0")` so I think my root question is: does usocket.write allocate any memory?

2. Does umqtt.simple.check_msg() send any data over the network? The key bit of code is in the umqtt.simple.wait_msg() function: `msg = self.sock.read(sz)`. I have a very simple task loop that checks a sensor and checks for MQTT messages. I don't want to flood my wifi network with an infinite loop of "query" type messages, so I can put a sleep statement in the task loop if necessary but if `self.sock.read(sz)` is "read-only", I'll just let it go as fast as possible.