Skip to content

Commit

Permalink
Updated documentation for connection using ALPN (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
scb01 authored and frankmuellr committed Mar 11, 2019
1 parent eb51cbf commit 7b90d19
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ios/pubsub.md
Expand Up @@ -89,6 +89,8 @@ Before you can publish/subscribe to a topic, you need to establish a connection.

#### Certificate based mutual authentication

To connect with the AWS IoT Core service on the standard MQTT port 8883, you can use the `connect` API as shown below.

```swift
func mqttEventCallback(_ status: AWSIoTMQTTStatus ) {
print("connection status = \(status.rawValue)")
Expand All @@ -100,8 +102,21 @@ iotDataManager.connect(withClientId: "<YOUR_CLIENT_ID>",
statusCallback: mqttEventCallback
```

The AWS IoT Core service also allows you to connect devices using MQTT with certificate based mutual authentication on port 443. You can do this using the `connectUsingALPN` API as shown below. See [MQTT with TLS client authentication on port 443](https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/) for more information.

```swift
func mqttEventCallback(_ status: AWSIoTMQTTStatus ) {
print("connection status = \(status.rawValue)")
}

iotDataManager.connectUsingALPN(withClientId: "<YOUR_CLIENT_ID>",
cleanSession: true,
certificateId: "<YOUR_CERTIFICATE_ID>",
statusCallback: mqttEventCallback
```

You can take a look at the [API Reference](https://aws-amplify.github.io/aws-sdk-ios/docs/reference/Classes/AWSIoTDataManager.html#//api/name/connectWithClientId:cleanSession:certificateId:statusCallback:
) to know more information.
) to get more information.

#### AWS Credentials based Authentication

Expand Down

0 comments on commit 7b90d19

Please sign in to comment.