MQTT Brokers

Aus hyperdramatik
Zur Navigation springen Zur Suche springen

see also https://www.kobakant.at/DIY/?p=9140

BROKER OPTIONS

In general these are the different Broker options you have:

public online

- a public online Broker hosted by somebody else (for example: Shiftr "try" namespace, Mosquitto's "test" server)

private online

- an online service (free or paid) that allows you to host your own Broker (for example: Shiftr)

localhost

- a local Broker that you run on your own computer or a designated computer (like a Rasberry Pi) (for example: Shiftr Desktop App, Mosquitto)

SHIFTR BROKER

super nice and simple with amazing visualization! and all options from public and free to paid and private to desktop app.

Notes from working with Shiftr Brokers

49856212336_cf2c240d1e.jpg

SHIFTR ONLINE

Shiftr has an public online namespace called "try" where you can quickly and easyily start publishing and subscribing data: https://www.shiftr.io/try

When you connect to this space with a Client, You should be able to see yourself pop up as your Client ID name (tip: pick a unique name to see yourself!). When you publish or subscribe data from the Broker you should see black balls flying from you to the center to the topic you are publishing to, or the other way around when you subscribe.

51678953412_d41d0fcac8_c.jpg

The visualization is interactive, you can click on nodes and pull them around to arrange the space. There is a lot going on here. If you want to use Shiftr for a project, you can create your own account for free and can have your own private or public namespaces.

C4k9CPnWcAARBvF.jpg

Shiftr has libraries for various platforms including Arduino and Processing.


SHIFTR Desktop App

You should be able to see your connections and data in the app, just like in the online visualization. Running this App means your computer is hosting a localhost MQTT broker. How cool is this! If you only need to send data locally, then you don't need to send it over the internet! All the devices publishing and subscribing just need to be in the same network (for example: connected to the same wifi network).

A LITTLE BIT ABOUT IP ADDRESSES: in the network settings of your computer: if you set your IP address to be dynamic (DHCP) then the router will assign you computer an IP address every time you sign in/out of the network. good routers tend to remember devices and will try to give you the same IP address as before, but no guarantee. so you have two options: manually give the computer running the Broker a fixed IP address. this will be problematic if/when you switch to a different network, but then just turn it back to DHCP to check the new router’s IP and pick a new fixed IP. because you need to make sure the IP address you manually give your computer corresponds with your router’s IP address so that only the last number is different. for example: my router’s IP is: 192.168.1.1 so i gave my computer the fixed IP: 192.168.1.9 re-programm your clients every time your set up the Broker with it’s current IP address.

51679759731_539ee1e99d_c.jpg

Download App for free: https://www.shiftr.io/desktop

To connect to this Broker, you need to find out the IP address of the computer running the App.

On a Mac: network settings --> Advanced --> TCP/IP --> IPv4 Address: 192.168.0.9 (for example)