Giter VIP home page Giter VIP logo

Comments (3)

vvangelov avatar vvangelov commented on July 17, 2024

Hi, I am setting up method with keepalive and cleansession. When I turn off my device I still don't get any msg from lwt.
This is my "begin" configuration, but it doesn't work.
mqtt.begin(mqtt_broker_server, {.lwtTopic = status_topic, .lwtMsg = "offline", .lwtQos = 0, .lwtRetain = 1}, 600, false);
Is it something in common that keepalive here is specified in milliseconds, and default keepalive in mosquitto broker is in seconds. Or I am wrong?
If someone can help, I will be happy.

from esp8266mqttclient.

vgooljar avatar vgooljar commented on July 17, 2024

Hi, I am setting up method with keepalive and cleansession. When I turn off my device I still don't get any msg from lwt.
This is my "begin" configuration, but it doesn't work.
mqtt.begin(mqtt_broker_server, {.lwtTopic = status_topic, .lwtMsg = "offline", .lwtQos = 0, .lwtRetain = 1}, 600, false);
Is it something in common that keepalive here is specified in milliseconds, and default keepalive in mosquitto broker is in seconds. Or I am wrong?
If someone can help, I will be happy.

I strongly recommend checking out PubSubClient
It's much more mature and behaves more predictably for MQTT stuff. If your payload sizes are greater than 128 characters, you'll have to edit this in the header files

from esp8266mqttclient.

vvangelov avatar vvangelov commented on July 17, 2024

I changed PubSubClient lib with this one, because it support all qos levels and wifisecure. I am still searching for the perfect one.
I think I found solution for my problem. I replace this line in ESP8266MQTTClient.cpp
_connect_info.keepalive = _keepalive;
with this one
_connect_info.keepalive = _keepalive / 1000;
I am using mosquitto for broker and i just converting the milliseconds to seconds in connect data.

from esp8266mqttclient.

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.