Sandeep Paithankar
Sandeep Paithankar

Reputation: 1

To connect with AWS IoT broker in iOS

We are developing an application which needs to consume AWS IoT service based on a MQTT protocol deviation. We are currently facing issues to get connected with MQTT broker provided by AWS IoT cloud server.

Following is the environment:

  1. iOS Version: 8.0 / 9.0
  2. Programming language: Swift
  3. Library for MQTT: Moscapsule

Steps followed:

  1. Set initial config clientid, host, port
  2. Set client certificate with private key, providing .pem file path (e.g. cert.pem, privateKey.pem)
  3. Set server certificate which is root certificate .pem file path (e.g. rootCA.pem)
  4. Set tls opts with tsl_insecure: false, cert_reqs: SSL_VERIFY_PEER, tls version: tlsv1.2, ciphers: nil

Problems faced:

  1. When trying to connect to server/broker gives error “unable to create TLS_Context”.
  2. With setting tls cert_reqs: SSL_VERIFY_NONE, gives connection status success with subcribe and publish sucess, but doesn’t reflect on server or broker.

Any help in this context is highly appreciable.

Upvotes: 0

Views: 2084

Answers (1)

garyw_aws
garyw_aws

Reputation: 101

The AWS SDK for iOS already supports connecting to AWS IoT over MQTT. You can see an example Swift program which transfers data to and from AWS IoT over MQTT using certificate-based authentication here. If you'd like to use a different MQTT client and just need to know how to set it up, you might start with the AWS SDK for iOS, and then have a look at the code involved in setting up the TLS connection.

Thanks for using AWS IoT.

Upvotes: 2

Related Questions