Author Topic: mqtt communication  (Read 1198 times)

0 Members and 1 Guest are viewing this topic.

Offline BlogRahul

  • Regular Contributor
  • *
  • Posts: 70
  • Country: in
mqtt communication
« on: May 31, 2022, 09:53:34 am »
I am trying to understand mqtt communication.   I have installed mosquitto mqtt and it's running on widows 10 PC. I have also installed paho mqtt on my window PC.  Python

I understand MQTT broker is a server. It provides socket connections and services. There are MQTT clients. These can publish topics or subscribe to topics or both.

https://mosquitto.org/documentation/ 

How to test mqtt communication on window PC using terminal ?
 

Offline Codemonkey

  • Regular Contributor
  • *
  • Posts: 235
  • Country: gb
Re: mqtt communication
« Reply #1 on: May 31, 2022, 10:04:17 am »
Not sure how you can test it using a terminal, but you could download and run mqtt-spy which is a java application that allows you to connect to a broker and send messages, subscribe to topics, see messages posted by other clients to a topic etc.
 

Offline BlogRahul

  • Regular Contributor
  • *
  • Posts: 70
  • Country: in
Re: mqtt communication
« Reply #2 on: May 31, 2022, 04:38:06 pm »
Not sure how you can test it using a terminal, but you could download and run mqtt-spy which is a java application that allows you to connect to a broker and send messages, subscribe to topics, see messages posted by other clients to a topic etc.

Can mqtt communication be checked by making same device as broker and client?

I have only windows 10 pc, can i check mqtt communication by making it broker and client without using any other device?
 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: se
Re: mqtt communication
« Reply #3 on: May 31, 2022, 04:56:59 pm »
Sure it can. Just set up a broker and use clients to connect to it. One computer is more than enough.
 

Offline Fredderic

  • Regular Contributor
  • *
  • Posts: 55
  • Country: au
Re: mqtt communication
« Reply #4 on: May 31, 2022, 04:59:30 pm »
I find this works pretty effectively:

Code: [Select]
mosquitto_sub -t '#' -v
Quite often have that just running in a window so I can see the traffic flying past.
 

Online tellurium

  • Regular Contributor
  • *
  • Posts: 112
  • Country: ua
Re: mqtt communication
« Reply #5 on: May 31, 2022, 06:07:02 pm »
There is another possibility:
A web-based clients exists too, e.g. http://www.hivemq.com/demos/websocket-client/
They use PAHO library, and wrap MQTT messages into Websocket frames.
In order to use such clients, a server should also support MQTT-over-Websockets.
Mosquitto can do that, http://www.steves-internet-guide.com/mqtt-websockets/

Wrapping MQTT into Websocket gives an ability to talk to your MQTT server from a web page / web application.
Open source embedded HTTP/MQTT/Websocket library | Web: https://mongoose.ws | Github: https://github.com/cesanta/mongoose
 

Offline BlogRahul

  • Regular Contributor
  • *
  • Posts: 70
  • Country: in
Re: mqtt communication
« Reply #6 on: June 01, 2022, 04:52:25 am »
Sure it can. Just set up a broker and use clients to connect to it. One computer is more than enough.

I find this works pretty effectively:

Code: [Select]
mosquitto_sub -t '#' -v
Quite often have that just running in a window so I can see the traffic flying past.

I ran following command on terminal
Code: [Select]
  net start mosquitto
It show requested service has already started

I get error when run this command
Code: [Select]
mosquitto_sub -t '#' -v   
mosquitto_sub is not recognize as internal or external command

How do you check on windows terminal?
« Last Edit: June 01, 2022, 04:54:31 am by BlogRahul »
 

Offline BlogRahul

  • Regular Contributor
  • *
  • Posts: 70
  • Country: in
Re: mqtt communication
« Reply #7 on: June 03, 2022, 03:00:27 pm »
I find this works pretty effectively:

Code: [Select]
mosquitto_sub -t '#' -v
Quite often have that just running in a window so I can see the traffic flying past.
Have you tried this command on your window PC? It doesn't work for me
 

Offline Fredderic

  • Regular Contributor
  • *
  • Posts: 55
  • Country: au
Re: mqtt communication
« Reply #8 on: June 03, 2022, 07:09:36 pm »
On Windoze?  Good question.  Nope.  No idea.  Never even considered MQTT on Windoze…

I'd have thought it'd still have the basic tools with it, though…  Maybe they're just not in the path?

Failing that, you could probably install it under WSL, for a more normal install…  Or just go with the web tools as mentioned already…

I just find being able to have a simple stream of everything in a console window is easy and very useful.  Though, it quickly becomes hard to tell anything at all once it gets busy — which is when you narrow it down to specific topics.  I've tried some of those web tools, and I keep going back to that simple command on the Linux system I run servery type stuff on.
 

Offline tepalia02

  • Regular Contributor
  • *
  • Posts: 102
  • Country: bd
Re: mqtt communication
« Reply #9 on: June 25, 2022, 10:43:02 am »
If you want to understand MQTT, here is a good write-up for you. It explains well  What  MQTT is. So, in order to understand MQTT Protocol, we need to know some terms. This tutorial covers all of them.

https://www.theengineeringprojects.com/2021/11/esp32-mqtt.html
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 1774
  • Country: gb
 

Online tellurium

  • Regular Contributor
  • *
  • Posts: 112
  • Country: ua
Re: mqtt communication
« Reply #11 on: June 25, 2022, 12:11:50 pm »
https://www.theengineeringprojects.com/2021/11/esp32-mqtt.html

404 for me

Try https://www.hivemq.com/mqtt-essentials/ - their docs are quite good.
They also run a public free MQTT service.
And they have a web based client http://www.hivemq.com/demos/websocket-client/
Everything you need to learn MQTT without having to install a single bit.
Open source embedded HTTP/MQTT/Websocket library | Web: https://mongoose.ws | Github: https://github.com/cesanta/mongoose
 

Offline tepalia02

  • Regular Contributor
  • *
  • Posts: 102
  • Country: bd
Re: mqtt communication
« Reply #12 on: June 27, 2022, 09:52:53 am »
https://www.theengineeringprojects.com/2021/11/esp32-mqtt.html

404 for me

Try https://www.hivemq.com/mqtt-essentials/ - their docs are quite good.
They also run a public free MQTT service.
And they have a web based client http://www.hivemq.com/demos/websocket-client/
Everything you need to learn MQTT without having to install a single bit.

Oh. I think the site was under maintenance when you tried. I can access now.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf