Currently, I'm successfully running a mosquitto broker, subscribing to topics and publishing messages with clients in a local network.
How can I communicate with another local network which is located at a different IP address?
Should I set up 2 mosquitto brokers, one for each local network?
It is able to deliver data over the Internet in near real-time and with guarantees of delivery. MQTT is designed for IoT devices - lightweight, which enables low-cost device communication.
No, only the MQTT broker needs a fixed IP address (and preferably a DNS entry) so the clients know where to find it. All the MQTT clients (both subscribers and publishers), be they native MQTT or MQTT over websockets connect out to the broker.
When using MQTT over websockets, the websocket connection acts as an external tube for the MQTT protocol. The client/server receives the MQTT packet, which the server/broker converts into a websockets packet. The client/server unpacks the MQTT packet from the websockets packet and processes it normally.
The protocol is capable of transmitting data accurately under a low-bandwidth network. IBM released the MQTT protocol in 1999 to communicate between IoT devices without an active internet connection.
Because mqtt
use tcp
connections, there is also a safe way to do this as follows:
A private broker A behind a firewall. B private broker B behind another firewall. C cloud broker C on the internet.
Setup the bridge A to C in both directions. This must be configured on A. The safe tcp
link to the internet will be created by A.
Setup the bridge B to C in both directions. This must be configured on B. The safe tcp
link to the internet will be created by B.
This will create a much safer bridge and can be done even if you do not have control over the router or firewall.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With