Git Product home page Git Product logo

Comments (5)

Testato avatar Testato commented on September 23, 2024

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 with

rst 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.

mactro avatar mactro commented on September 23, 2024

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.

Imroy avatar Imroy commented on September 23, 2024

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.

mactro avatar mactro commented on September 23, 2024

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.

sudheera8 avatar sudheera8 commented on September 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.