You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[self.client connectToHost:kMQTTServerHost completionHandler:^(MQTTConnectionReturnCode code) { SYLog(@"client is connected with id %@", clientID);
if (code == ConnectionAccepted) {
SYLog(@"did connect...");
// The client is connected when this completion handler is called
SYLog(@"client is connected with id %@", clientID);
// Subscribe to the topic
[weakself.client subscribe:[NSString stringWithFormat:@"%@_%@", kTopic, usercount.enterprise_code] withCompletionHandler:^(NSArray *grantedQos) {
// The client is effectively subscribed to the topic when this completion handler is called
SYLog(@"subscribed to topic %@", [NSString stringWithFormat:@"%@_%@", kTopic, usercount.enterprise_code]);
BOOL res = [weakself.client enableBackgrounding];
if (!res) {
SYLog(@"Failed to enable background socket...");
}
}];
} else {
SYLog(@"Failed to connect to server...");
}
}];
[application setKeepAliveTimeout:600 handler:^{
SYLog(@"timeout handler activited...");
[weakself.client reconnect];
}];
The text was updated successfully, but these errors were encountered:
When the timeout to reconnect, prompts the clientid is connected, return to the state of “ConnectionRefusedIdentiferRejected”
My code is as follows
self.client = [[MQTTClient alloc] initWithClientId:clientID cleanSession:YES];
[self.client connectToHost:kMQTTServerHost completionHandler:^(MQTTConnectionReturnCode code) { SYLog(@"client is connected with id %@", clientID);
The text was updated successfully, but these errors were encountered: