TTS Mqtt Integration

topic_3
I am currently working on a LoRaWan Test Setup using TTS. I am running the TTS locally. The Servers are up and running (using Docker) and my end-device can connect to it. My operating system is windows.

topic_2
I am now at the point that i want to extract the data using the mqtt integration. But this is where i am currently stuck. I was testing the mqtt with the help from eclipse-mosquitto but for some reason i just can’t connect to the mqtt server.

What i noticed after a few hours of digging is that there are 2 processes running on port 1883. One is the Docker application so that one is the mqtt integration, the other one is from mosquitto. So this makes me believe that for some reason the mosquitto client can’t connect to the mqtt server because this one is running in docker?
topic
Mosquitto client in cmd: mosquitto_sub -h “localhost” -p “1883” -t “#” -u “appli-test” -P “NNSXS.AX4HV…” -d

I understand that offering support on self hosted deployments can be a bit tricky, but it would be amazing if someone could point me in the right direction or show my mistake.

Docker will expose the ports of the application running within a container, I don’t think docker itself uses port 1883

As far as I can tell Docker doesn’t change the port.
image

image

The “MQTT integration” would be an MQTT client which subscribed to, or in the case of the integration more importantly publishes data

The thing you need to connect your client to is the MQTT broker which accepts connections from multiple clients and exchanges data between them.

That may quite well be an instance of Mosquitto - which is primarily an MQTT broker package though yes a distribution also includes client tools that can be used with that broker, or (as MQTT is a standard) any other compliant broker.

Typically in a docker setup, there’d be a container dedicated to running the broker package - probably an instance of Mosquitto, but possibly something else. Hopefully that container is configured to expose the key broker ports to the hosting system, and not just to other containers.

docker ps -a may help you see what is actually running (or was supposed to be, but died)

Since the port is being used bij TTS i can’t run a mosquitto broker on docker. image
As far as I could understand, the TTS mqtt integration launches a mqtt server (so i should’t need an outside broker?)

But this got me thinking and trying something new. I made a mosquitto broker run using cmd. When the broker was running I subscribed using the mosquitto_sub mentioned in the top post. Then I stopped the self launched mosquitto broker.
This somehow caused the mosquitto_sub to subscribe to the TTS mqtt integration?
image

I am happy that it connects but I am so confused as to why/how it connects suddenly.

Probably - but its broker is distinct from its client.

Since the port is being used bij TTS i can’t run a mosquitto broker on docker.

That’s likely mixed up in two ways.

First you’re likely seeing the use of the port by the TTS MQTT client and thinking that reserves it; it doesn’t - connecting to a port doesn’t reserve it, it’s listening on the port (as only the broker would do) which does

Second, presumably there’s already a broker running in a docker container as part of the setup

I am guessing this is the case. This would explain why mqtt clients can connect without setting up an external mqtt broker.

As to why it is working suddenly. While I was trying multiple things I also did this: image
Then after I did this I manually started and stopped the broker. And Because i changed it to manual it did actually stop. And that could be why my mosquitto_sub suddenly subscribed to the TTS mqtt integration? It would also explain why it wouldn’t work before (since it would keep connecting to the mosquitto broker which was automatically running?)

I am not sure but this seems to be the most plausible explanation?
Can someone confirm or disprove this theory?

Realistically, your first step should probably be to run this in traditional Linux-based cloud infrastructure. It’s not that what you’re trying to do can’t work, it’s just that you introduce a bunch of “uncommon case” complications.

1 Like