MQTT-Client-Framework icon indicating copy to clipboard operation
MQTT-Client-Framework copied to clipboard

v0.15.2 MQTTSessionManager can not connect

Open 9527kevin opened this issue 6 years ago • 6 comments

Hello, When i use the v0.15.2 MQTTSessionManager to connect service ,it was error for this error:Error Domain=MQTT Code=-8 "Server has closed connection without connack." UserInfo={NSLocalizedDescription=Server has closed connection without connack.}.But, the demo which is using same parameter is good.

here below is the code:

[self.manager connectTo:@"192.168.1.109" port:1883 tls:NO keepalive:60 clean:NO auth:true user:@"user" pass:@"user123" will:NO willTopic:@"offline topic" willMsg:[@"offline" dataUsingEncoding:NSUTF8StringEncoding] willQos:MQTTQosLevelAtLeastOnce willRetainFlag:YES withClientId:clientId securityPolicy:nil certificates:nil protocolLevel:MQTTProtocolVersion311 connectHandler:^(NSError *error) {

}];

9527kevin avatar Jan 16 '19 07:01 9527kevin

@9527kevin if you set will to NO, you should set willTopic to nil, willMsg to nil, willQos to MQTTQosLevelAtMostOnce (=0) and willRetainFlag to NO

ckrey avatar Jan 17 '19 10:01 ckrey

How do we get error message from MQTTSessionManager for unauthorised user?

RajaReddyiOS avatar Feb 05 '19 06:02 RajaReddyiOS

Have you solved the problem??

Coder-ZJ avatar Mar 13 '19 09:03 Coder-ZJ

In my case, the port of broker that support websocket only.if you are the same solution you use MQTTWebsocketTransport class to create a transport for a MQTTSession.

asomeLiao avatar Sep 05 '19 01:09 asomeLiao

I have the same problem

wcgCoding avatar Nov 05 '19 03:11 wcgCoding

I have the same problem

now I solved my problem with set "auth" YES. because I have userName and password.

wcgCoding avatar Nov 06 '19 06:11 wcgCoding