Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MQTT over the internet?

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?

like image 213
Jorn.Beyers Avatar asked Mar 09 '15 10:03

Jorn.Beyers


People also ask

Can MQTT work over internet?

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.

Does MQTT require IP address?

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.

How do I use MQTT over websockets?

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.

Can you use MQTT without internet?

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.


1 Answers

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.

like image 125
skvery Avatar answered Sep 21 '22 21:09

skvery