-->
Page 2 of 5

Re: MQTT Messaging

PostPosted: Wed Jun 22, 2016 1:47 am
by forlotto
Hrmmm that is pretty interesting I can see why the want for such a thing... It is essentially a relayed chat with the device.

One question I do have though for the broker / server do you need to use one from a third party or is there some kind of code to run your own broker as well? I am kinda bummed about having to use the third party stuff unless I am hosting it.

Great explanation short sweet and to the point and I am sure the files will be way more than useful if implementation does happen down the road as mmiscool finds time.

Thanks Kingdem good stuff educated a bit more on the workings of mqtt.

case arrested :P

-forlotto

Re: MQTT Messaging

PostPosted: Sun Jul 03, 2016 5:17 pm
by Mmiscool
It looks like I might be able to have a new build out today that uses allows for MQTT usage.

I just started testing the demos from the library in this post and have success in getting it up and running.

Now to figure out what the commands will be for esp basic. Will probably be a setup command for mqtt, a subscribe command similar to msg branch and send command.


kingedem wrote:Just try looking at attached code here ..

In nutshell: Http request and response has bigger overhead (bandwidth) and latency as compares to MQTT messaging.

1. There is a Mosquitto (http://mosquitto.org/) runs on the server to which our esp8266 broadcast with unique "Topic" and "Message".
2. Any clients subscribed to the "topic" in that server will get the message instantly.

Its TCP socket connection and does not keep it live.

Re: MQTT Messaging

PostPosted: Mon Jul 04, 2016 1:01 am
by ilc
This is welcome news, thanks Mike. I don't know much about MQTT however I have been looking at node-red and this may be a good way (along with UDP) of hooking in to it.

Mmiscool wrote:It looks like I might be able to have a new build out today that uses allows for MQTT usage.

I just started testing the demos from the library in this post and have success in getting it up and running.

Now to figure out what the commands will be for esp basic. Will probably be a setup command for mqtt, a subscribe command similar to msg branch and send command.

Re: MQTT Messaging

PostPosted: Wed Jul 06, 2016 11:23 pm
by Mmiscool
New build with initial MQTT support posted.

There is no documentation yet. But the following demo program should give you a taste.

The mqttbranch will only execute if the latest msg is not the same as the previous.

Any message that you want to reach the esp must have the retain flag set to true.

Messages published from the esp will have there retain flag set to true.

Code: Select allmyMSG = "ESP Test"
mqtt.setup("broker.mqttdashboard.com")
mqttbranch [newmsg]
mqtt.subscribe("mmiscool")

[reset.window]
cls
textbox myMSG
button "Send", [send]
button "Clear the screen",[reset.window]
wait

[send]
mqtt.publish("mmiscool",myMSG)
wait


[newmsg]
print mqtt.msg()
wait