prwiley
Posts: 11
Joined: Tue Jun 19, 2018 2:08 pm
Location: Pennsylvania USA

Cannot get multiple iOS mqtt clients to connect to Pi Broker

Wed Jul 25, 2018 7:16 pm

I am working a project that relies on connecting iOS devices (via CocoaMQTT) to and mqtt server/broker running on a Pi.

With one iOS device things work just as they should. When I try to connect with a second iOS device, things fall apart.

The second device attempts to connect and then immediately disconnects and I get an error on the xCode console (running the second device) : "Could not resolve hostname: nodename nor servname provided, or not known"

I am new enough at this not to know if this is an issue on the Pi side or an issue on iOS side.

I wonder if anyone could point me in the direction of how to debug?

Thanks!

mattmiller
Posts: 2125
Joined: Thu Feb 05, 2015 11:25 pm

Re: Cannot get multiple iOS mqtt clients to connect to Pi Broker

Wed Jul 25, 2018 7:46 pm

I'd suspect that its a problem with your CocoaMQTT clients - maybe the 2nd one is trying to connect using same clientID as the 1st one or something like that

Instead of trying 2nd instance of CocoaMQTT, can you try another client instead?

@DougieLawson is the resident mosquitto/MQTT resident around here and once he turns up I'm sure he'll be able to offer some good debugging advice for you :)

prwiley
Posts: 11
Joined: Tue Jun 19, 2018 2:08 pm
Location: Pennsylvania USA

Re: Cannot get multiple iOS mqtt clients to connect to Pi Broker

Thu Jul 26, 2018 1:39 pm

It was the client id issue. Just didn't think of it.

I wrote some code to give each device its own id when connecting to the broker and all worked it should.

Return to “Networking and servers”