Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket error on bridge connection to the things network (TTN) #1635

Closed
pokerazor opened this issue Mar 23, 2020 · 3 comments
Closed

Socket error on bridge connection to the things network (TTN) #1635

pokerazor opened this issue Mar 23, 2020 · 3 comments

Comments

@pokerazor
Copy link

Hi. We are trying to set up an inward bridge connection to https://www.thethingsnetwork.org/docs/applications/mqtt/api.html

The config looks like this:

connection external-bridge
address eu.thethings.network:1883

notifications false
topic # in 0 /foo/buzz /foo/bar
cleansession true
local_username XXX
local_password XXX
#remote_clientid customclient
remote_username XXX
remote_password ttn-account-v2.XXX
bridge_protocol_version mqttv311
try_private false

But we are getting an error as follows:

1584968360: Connecting bridge (step 1) external-bridge (eu.thethings.network:1883)
1584968360: Connecting bridge (step 2) external-bridge (eu.thethings.network:1883)
1584968360: Socket error on client local.mosquitto.external-bridge, disconnecting.

It works via the commandline:
mosquitto_sub -u XXX -P ttn-account-v2.XXX -t 'XXX/#' -h eu.thethings.network -d -v -p 1883

We tried with and without TLS, we are certain that the credentials are correct (otherwise we get an auth error), also it looks suspicious that the local.mosquitto.external-bridge is mentioned with the local. part, so it seems the external connection works, but the local not? The connection attempt is repeated every couple of seconds, always with the same result. We also tried connecting to our own server through the external port, that worked. Any idea what we're might be doing wrong or how we could debug better? Unfortunately, the log doesn't say what kind of socket error or why...
Thanks in advance.

@karlp
Copy link
Contributor

karlp commented Mar 26, 2020

try adding attempt_unsubscribe = false, that's another one I've had to add with some cloud brokers? but you've already covered the usual suspects (notifications, try_private and cleansession) so nothing obvious

@ralight
Copy link
Contributor

ralight commented Mar 28, 2020

topic # in 0 /foo/buzz /foo/bar

The documentation states For incoming topics, the bridge will prepend the pattern with the remote prefix and subscribe to the resulting topic on the remote broker That means that your bridge is trying to subscribe to /foo/bar#, which in an invalid topic. That's assuming your config there matches what you have in reality. I've just pushed a change which will report these invalid combinations at configuration time, rather than letting the bridge fail in an unexpected way like you are seeing.

ralight added a commit that referenced this issue Mar 28, 2020
Rather than letting the bridge fail later.

Issue #1635. Thanks to pokerazor.
@pokerazor
Copy link
Author

Thanks for your responses! Yes, the problem was the notation of the topic for the local client.
We now got it running with topic # both 2 external/ttn/ "", none of the additional

    bridge_protocol_version mqttv311
    try_private false
    bridge_attempt_unsubscribe false
    cleansession true
    notifications false

was necessary for connecting to The Things Network.

Those additional checks and detailed error messages at config parsing time will be extremely helpful, thank you! :-)

FranciscoKnebel pushed a commit to Open-Digital-Twin/mosquitto that referenced this issue Jul 30, 2020
Rather than letting the bridge fail later.

Issue eclipse#1635. Thanks to pokerazor.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants