Closed vldn20 closed 7 years ago
Are you connecting to 127.0.0.1 from your iOS app? I don't think there's a Mosquitto broker running there ... :-)
No. IP is random :-)
Yep, on latest pod version we don't recieve messages some times with mosquitto server. Checking...
Can you do me a favor and check if you can connect and subscribe successfully with mosquitto_sub to both of your servers
Would you then check if you are connecting MQTT V3.1 or MQTT V3.1.1?
-V : specify the version of the MQTT protocol to use when connecting. Can be mqttv31 or mqttv311. Defaults to mqttv31.
The MQTT Client Library connects using MQTT V3.1.1 per default. You may change this by setting
self.session.protocolLevel = 3; before connecting.
Could you check the status of the connection before subscribing?
if (self.status == MQTTSessionStatusConnected) ...
I tried to connect to mosquitto version 1.4.2 with self.session.protocolLevel = 3 and self.session.protocolLevel = 4; It did not help me. I connected to the server and subscribed without errors, but not receiving messages. I can not check self.session.protocolLevel = 3 for the mosquitto version 1.3.4
In your code sample shown initially, what are you doing after
[self.session connectAndWaitToHost:@"127.0.0.1" port:1883 usingSSL:NO]; [self.session subscribeToTopic:@"notification" atLevel:MQTTQosLevelExactlyOnce]; }
Are you keeping the thread running? Without that, you get no message?
Can you show me a bit more of your code? Or have a look at the examples in the Test package or in the demo application https://github.com/ckrey/MQTTChat
@nv2089 were you able to resolve your issue?
Subscribe after connected
[self.session connectToHost:@"domain.com" port:8883 usingSSL:YES connectHandler:^(NSError *error) {
[self.session subscribeToTopic:@"test/topic" atLevel:MQTTQosLevelExactlyOnce];
}];
@nv2089 were you able to resolve your issue? Can we close the issue?
Hello! I can not get messages. mosquitto version 1.3.4 (build date 2014-08-17 00:14:52-0300), Debian 8.0 - I get the messages mosquitto version 1.4.2 (build date Mon, 18 May 2015 15:25:19 +0100), Ubuntu 14.04 LTS - Not receiving messages
Paho works well on both versions
I tested for this code