MQTT (Message Queuing Telemetry Transport ) is way to send messages from one device to another and is the Standard for IoT Messaging.
Details for using click here EspMQTTClient
MQTT is a publish/subscribe (pubsub) wire protocol designed with small devices in mind. Pubsub systems work like a message bus. You send a message to a topic, and any software with a subscription for that topic gets a copy of your message.
in MQTT topics are not preregistered. A sender can create topics on the fly, the only limit being that they are less than 220 characters. The / character is special; it's used to create topic hierarchies.
two wildcards are allowed:
# matches everything recursively to the end
+ matches only until the next / character
MQTT Broker
how to install and setup the Mosquitto MQTT server, available at www.mosquitto.org, on a Windows PC.
MQTT Network Controller
MQTT Network Controller
Uses the Arduino Client for MQTT
Download from https://github.com/knolleary/pubsubclient
Mosquitto for Windows
Mosquitto for Windows comes in 32-bit and 64-bit flavours.
In both cases, the dependencies are not provided in this installer and must be
installed separately in the case that they are not already available.
See also readme-windows.txt after installing.
To Publish
Using Windows, open 'Command Prompt'
Change directory(CD) to your mosquitto installation, example CD D:\mosquitto
mosquitto_pub -h [host] -p [port] -t [topic] -m "[message]"
Ex: mosquitto_pub -h 192.168.1.66 -p 1883 -t Topic -m "My text"
Capabilities
Some versions of Windows have limitations on the number of concurrent connections, set at approximately 2048 connections depending on the version of Windows you are using.
The topic string is at most 65536 bytes. This is a limit imposed by the mqtt spec, you can't change it. It is also worth noting that the topic is encoded with utf-8, so you may have less than 65536 characters available.
The payload of the message is limited to 268,435,456 bytes. Again, this is defined by the spec.
Websockets
Example file:///D:/mosquitto/WebSocket.htm
D: mosquitto javascript-websockets websockets-3.htm
Please note that on Windows, libwebsockets limits connections to a maximum of 64 clients.
Example to setup websockets edit mosquitto.conf , under # Default listener add the following 3 lines Opening port 9001 on windows :
port 1883
listener 9001
protocol websockets
Note if mosquitto was running you will need to stop and restart it.
Administrator Command prompt: net stop mosquitto
then type: net start mosquitto
Then open port 9001 run firewall.clp 'advanced settings'
'inbound rules' click on 'New rules'
rule type Port TCP 1883 enter, enter, enter and you can add the name "MQTT Service Port"
'inbound rules' click on 'New rules'
rule type Port TCP 9001 enter, enter, enter and you can add the name "websocket"
Library Thread Support
libmosquitto on Windows is currently compiled without thread support, so
neither of mosquitto_loop_start() nor "mosquitto_pub -l" are available.
A better solution that the old pthreads-win32 is being looked into, so support
will return in the future. If you need thread support, the code still supports
it just fine. Support has been dropped to simplify installation.
Dependencies
* OpenSSL
Link: http://slproweb.com/products/Win32OpenSSL.html
Install "Win32 OpenSSL 1.1.0* Light" or "Win64 OpenSSL 1.1.0* Light"
Required DLLs: libssl-1_1.dll, libcrypto-1_1.dll or libssl-1_1-x64.dll, libcrypto-1_1-x64.dll
Please ensure that the required DLLs are on the system path, or are in the same directory as
the mosquitto executable - usually C:\Program Files (x86)\mosquitto or C:\Program Files\mosquitto.
Windows Service
If you wish, mosquitto can be installed as a Windows service so you can
start/stop it from the control panel as well as running it as a normal
executable.
When running as a service, the configuration file used is mosquitto.conf in the
directory that you installed to.
If you want to install/uninstall mosquitto as a Windows service run from the
command line as follows:
C:\Program Files\mosquitto\mosquitto install
C:\Program Files\mosquitto\mosquitto uninstall
Logging
If you use `log_dest file ...` in your configuration, the log file will be
created with security permissions for the current user only. If running as a
service, this means the SYSTEM user. You will only be able to view the log file
if you add permissions for yourself or whatever user you wish to view the logs.
Raspberry Pi
Easy MQTT Server Setup