Comments (5)
Mqtt is writed for realtime execution ?
Example, is it writed for drive a Drone ?
I think about it like a notify sistem
Il 22/lug/2015 02:58 PM, "mactro" [email protected] ha scritto:
I have following code running on ESP:
void loop()
{
if(millis() - t > 10) {
static int i = 0;
String topic = "test/" + String(i % 10);
String msg = "some test message " + String(t);
mqtt->publish(topic, msg);
i++;
t = millis();
}
mqtt->loop();
}When I subscribe to the test/# topic I would expect the counter on the end
of the message to have difference close to 10 between subsequent messages,
but I usually get something around 100-200. What is even more bizzare, when
I set up a python script on the PC to publish messages in 30ms intervals to
a topic that ESP is subscribed to, the publishing rate accelerates to
something around 20ms. Unfortunately after some time, ESP reboots withrst cause:4, boot mode:(3,6)
wdt reset
load 0x40100000, len 28780, room 16
tail 12
chksum 0x35
ho 0 tail 12 room 4
load 0x3ffe8000, len 1548, room 12
tail 0
chksum 0x90
load 0x3ffe8610, len 3300, room 8
tail 12
chksum 0x88
csum 0x88—
Reply to this email directly or view it on GitHub
#22.
from pubsubclient.
Of course mqtt is not for real time, but publishing or receiving 100 messages per second is faaar from real time. Besides, I don't mind occasional delays, as long as average frequency will be around these 100Hz.
from pubsubclient.
To see how long the publish() and loop() methods can take, I modified the mqtt_basic sketch like this:
uint32_t t = millis();
client.publish("outTopic", "hello world");
Serial.printf("Publish took %dms\n", millis() - t);
and
t = millis();
client.loop();
Serial.printf("Loop took %dms\n", millis() - t);
Client.loop() almost always took "0ms" (i.e < 1 ms). Client.publish() took much longer - from less than 10 ms to over 100 ms. I don't know if there's much we can do about this. It's all up to the Espressif SDK and the Wifi network.
from pubsubclient.
Ok, I have edited a topic to reflect your measurements. I have also done some additional testing with different QoS settings.
- QoS 0 gives results as desribed in the first post
- QoS 1 takes around 50ms between loop iterations, but there are 10 duplicate messages for every single message published (so 11 same msgs in total).
- With QoS 2, I can run the loop at 100Hz rate, but ESP reboots after couple of seconds.
from pubsubclient.
Hi All
I have been using this library with ATWINC1500. I started off with using knolleary/pubsubclient
but my requirement for QOS2 made me this fork of it. However,I have been experiencing the same speed issues. Can any one help me figure this out?
Thanks in advance.
sudheera
from pubsubclient.
Related Issues (20)
- Subscribe to two topics?
- Compatibility broken with original knolleary/pubsubclient lib HOT 1
- Wrong password HOT 3
- lib update installs the knolleary lib HOT 4
- Message published multiple times HOT 1
- MAX transfer size is not found
- more than one Nodemcu clients can't able to get published message at a time HOT 1
- Multiple unsubscribe or publish with QoS 1 in callback HOT 1
- How to set the callback from a c++ class? HOT 1
- wrong hostname used
- esp12F heating issue HOT 1
- Unable to ascertain if received message is 'retained'. HOT 15
- socket error
- ESP32 HOT 1
- Memory leak on loop() HOT 1
- can this library subscribe to mqtt topic ? HOT 1
- error "MQTT' does not name a type" when compiling ESP8266-OTA example HOT 1
- PubSubClient.connect with userName/password ? HOT 1
- control reaches end of non-void function HOT 1
- beebotte.com - retain vs write API (weird persistance, possible to add) - not a bug I think
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pubsubclient.