I want to send a message from a iOS application to my PC using MQTT protocol . I have installed a HiveMQ broker in my fedora and I am able to start it .
Using my PC's IP address can I send message ?.
How can I access the received message in the PC ?.
Do I need a another program to write this received message into a text file ?.
Asked
Active
Viewed 663 times
0

SP_
- 241
- 1
- 5
- 16
1 Answers
0
Yes, you need a subscriber application.
The start with you could install the mosquitto (another broker) but along with it you will get 2 command line tools (mosquitto_sub & mosquitto_pub)
You can use mosquitto_sub to subscribe to the topics you are publishing to and this will print the payloads out to std_out
mosquitto_sub -t 'some/topic' -h 127.0.0.1 -p 1883 > file.txt
This will write each new message to a new line in the file.
If you want to do anything more complicated with the message you will probably have to write some custom code, you can use any of the libraries that have Paho APIs (http://www.eclipse.org/paho/) or one of the other API implementations (https://github.com/mqtt/mqtt.github.io/wiki/libraries)

hardillb
- 54,545
- 11
- 67
- 105