CocoaMQTT icon indicating copy to clipboard operation
CocoaMQTT copied to clipboard

How to connect to a broker on the network

Open GraceStangroome opened this issue 1 year ago • 4 comments

Hello, I'm new to programming in Swift and networking, so please be gentle, but I'm really confused about how I actually get the Swift app to connect to a broker. I have the App working okay, and the broker works, and I essentially copied the example in the GitHub, but now what? What functions do I need to call, and how do I call them? My broker is a Raspberry Pi on the same network as the iPad.

I really appreciate any help you can provide.

GraceStangroome avatar Sep 27 '23 16:09 GraceStangroome

Hello. You can run the demo first and try to read the code. If you have the problem, you can list here. Thks~

leeway1208 avatar Oct 08 '23 15:10 leeway1208

I did that, and I am still struggling. It doesn't seem to be connecting to the broker at all. Any advice?

I think a bad connection isn't working correctly. When I try to use it and the broker is switched off (so cannot be working), the debug output says it connected and subscribed to a topic and published a message. When I look at the logs on the broker when it is switched on, it states a new connection from the iPad IP's, and then says Client disconnected due to protocol error.

GraceStangroome avatar Oct 11 '23 09:10 GraceStangroome

It seems like there is a problem with the broker settings?

leeway1208 avatar Oct 11 '23 13:10 leeway1208

I think that's fine because when I connect to the broker and publish from my Mac's terminal, everything works as expected, so it's definitely due to my Cocoa code

GraceStangroome avatar Oct 11 '23 14:10 GraceStangroome