We used AWS iOS IoT SDK with ssl configuration. We followed https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift as a reference. Here our server end point will be of format
https://xxxxxxxxxx.iot..amazonaws.com
We imported pkcs12 file in a bundle and able connect, publish, subscribe to the server.
Later we thought of having local network solution within our organization for that, We set up rabbitmq for MQTT broker for serverhttps://www.rabbitmq.com/ssl.html#keys-and-certs. Currently, we are trying by using an ec2 instance, latter will setup local server. And end point is
ssl://ec2-..compute.amazonaws.com:8883
Now I'm unable to connect to rabbitmq server using aws iot ios sdk.
But If I use https://github.com/emqtt/CocoaMQTT sample, I'm able to connect to both aws iot server endpoint, rabbitmq server end point.
What should I do now to get connect to rabbitmq server end point using aws iot ios sdk https://github.com/aws/aws-sdk-ios/tree/master/AWSIoT. What edits I should make in sdk?
Below are the logs when tried to connect to rabbitmq server using aws iot ios sdk.
2017-07-27 12:56:55:860 sample[2124:1004208] hostName: ec2-<ip>.<region>.compute.amazonaws.com
2017-07-27 12:56:55:861 sample[2124:1004208] URL: ssl://ec2-<ip>.<region>.compute.amazonaws.com
2017-07-27 12:56:55:875 sample[2124:1004208] -[MQTTSession initWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetainFlag:runLoop:forMode:] [Line 169], Thread:<NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:55:875 sample[2124:1004208] +[MQTTMessage connectMessageWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetain:] [Line 68], Thread:<NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:55:875 sample[2124:1004208] Creating MQTTMessage with raw data >>>>> <00044d51 54540406 003c0004 696f732d 0017746f 7069632f 77726974 652f736f 75726365 2f757365 7200787b 22636c69 5f657665 6e745f69 64223a22 636c695f 6576656e 745f7573 65725f31 35303131 34303431 352e3832 37393422 2c22736f 75726365 223a2273 6f757263 65222c22 73656e64 65725f69 64223a22 75736572 222c2265 76656e74 5f747970 65223a22 4c415354 5f57494c 4c5f4d45 53534147 45227d> <<<<<
2017-07-27 12:56:55:879 sample[2124:1004208] Initializing MQTTEncoder and MQTTDecoder streams
2017-07-27 12:56:55.882561+0530 sample[2124:1004208] ChatViewController: connection status = Connecting 1
2017-07-27 12:56:55:880 sample[2124:1004208] opening encoder stream.
2017-07-27 12:56:55:880 sample[2124:1004208] opening decoder stream.
2017-07-27 12:56:55:946 sample[2124:1004208] -[MQTTDecoder stream:handleEvent:] [Line 64] EventCode:1, stream: <__NSCFInputStream: 0x170112870>, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:55:947 sample[2124:1004208] -[MQTTEncoder stream:handleEvent:] [Line 71] EventCode:1, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:56.002911+0530 sample[2124:1004208] CFNetwork SSLHandshake failed (-9807)
2017-07-27 12:56:56:003 sample[2124:1004208] -[MQTTDecoder stream:handleEvent:] [Line 64] EventCode:8, stream: <__NSCFInputStream: 0x170112870>, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:56:003 sample[2124:1004208] -[MQTTSession decoder:handleEvent:] [Line 471] eventCode:2
2017-07-27 12:56:56:004 sample[2124:1004208] MQTT session error, code: 3
2017-07-27 12:56:56:004 sample[2124:1004208] closing encoder stream.
2017-07-27 12:56:56:005 sample[2124:1004208] closing decoder stream.
2017-07-27 12:56:57:008 sample[2124:1004208] MQTTSessionDelegate handleEvent: 3
2017-07-27 12:56:57:008 sample[2124:1004208] MQTT session connection error
2017-07-27 12:56:57.010082+0530 sample[2124:1004287] Chat :Alive service stop
2017-07-27 12:56:57.010521+0530 sample[2124:1004208] ChatViewController: connection status = Disconnected 5
2017-07-27 12:56:57.016899+0530 sample[2124:1004208] Chat :viewDidDisappear
2017-07-27 12:56:57:009 sample[2124:1004208] setting up reconnectTimer.
2017-07-27 12:56:58:010 sample[2124:1004208] Trying to reconnect to session.
2017-07-27 12:56:58:011 sample[2124:1004208] Initializing MQTTEncoder and MQTTDecoder streams
2017-07-27 12:56:58:011 sample[2124:1004208] opening encoder stream.
2017-07-27 12:56:58:011 sample[2124:1004208] opening decoder stream.
2017-07-27 12:56:58:075 sample[2124:1004208] -[MQTTDecoder stream:handleEvent:] [Line 64] EventCode:1, stream: <__NSCFInputStream: 0x170112bd0>, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:58:075 sample[2124:1004208] -[MQTTEncoder stream:handleEvent:] [Line 71] EventCode:1, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:58.127802+0530 sample[2124:1004208] CFNetwork SSLHandshake failed (-9807)
2017-07-27 12:56:58:128 sample[2124:1004208] -[MQTTDecoder stream:handleEvent:] [Line 64] EventCode:8, stream: <__NSCFInputStream: 0x170112bd0>, Thread: <NSThread: 0x170068000>{number = 1, name = main}
2017-07-27 12:56:58:128 sample[2124:1004208] -[MQTTSession decoder:handleEvent:] [Line 471] eventCode:2
2017-07-27 12:56:58:128 sample[2124:1004208] MQTT session error, code: 3
2017-07-27 12:56:58:128 sample[2124:1004208] closing encoder stream.
2017-07-27 12:56:58:128 sample[2124:1004208] closing decoder stream.
2017-07-27 12:56:59:129 sample[2124:1004208] MQTTSessionDelegate handleEvent: 3
2017-07-27 12:56:59:130 sample[2124:1004208] MQTT session connection error
2017-07-27 12:56:59.131627+0530 sample[2124:1004299] Chat :Alive service stop
2017-07-27 12:56:59.132071+0530 sample[2124:1004208] ChatViewController: connection status = Disconnected 5