TheThingsArchive / ttn

The Things Network Stack V2
https://www.thethingsnetwork.org
MIT License
461 stars 277 forks source link

Establish bridge connection to my own mosquitto broker #721

Closed FranciscoGJ closed 6 years ago

FranciscoGJ commented 6 years ago

How can I establish a bridge connection between my mosquitto broker and ttn broker mqtt??

johanstokking commented 6 years ago

There's some good documentation about this; http://www.steves-internet-guide.com/mosquitto-bridge-configuration/

It comes down to a client that subscribes to a TTN MQTT server and publishes to yours, and back. That may be an intermediate client, or builtin bridging functionality of Mosquitto.

FranciscoGJ commented 6 years ago

I tried to implement this functionality but I did not succeed. This is my config file in my mosquitto broker. `# Bridge to ttn

connection br-ms-to-ttn address us-west.thethings.network:1883 cleansession false clientid br-ms-ttn bridge_protocol_version mqttv311 bridge_insecure false start_type automatic remote_username ** remote_password ** notifications true try_private true topic ttn in 0` But I could not establish the connection.

johanstokking commented 6 years ago

Without any context (i.e. error messages) there's no way to debug this. Also, I don't think this is specific to the TTN MQTT server.

FranciscoGJ commented 6 years ago

I feel them, this is the error

1529471394: Config loaded from /etc/mosquitto/conf.d/bridge.conf. 1529471394: Opening ipv4 listen socket on port 1883. 1529471394: Opening ipv6 listen socket on port 1883. 1529471394: Connecting bridge br-ms-to-ttn (us-west.thethings.network:1883) 1529471425: Connecting bridge br-ms-to-ttn (us-west.thethings.network:1883) 1529471425: Connection Refused: unacceptable protocol version 1529471425: Socket error on client local.br-ms-ttn, disconnecting.

I think the error is in the mosquitto configuration but I do not understand what it can be.

johanstokking commented 6 years ago

Right, I see that Mosquitto tries some non-spec protocol for setting up the bridge. We are not supporting that and not going to.

You can run a simple client that subscribes to both and publishes from one to the other, instead.

FranciscoGJ commented 6 years ago

I think I will implement that solution. Thanks for the support