diff --git a/ios/pubsub.md b/ios/pubsub.md index 25eafc80ce..7a926c0a5d 100644 --- a/ios/pubsub.md +++ b/ios/pubsub.md @@ -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)") @@ -100,8 +102,21 @@ iotDataManager.connect(withClientId: "", 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: "", + cleanSession: true, + certificateId: "", + 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