AWSIoTMQTTConfiguration

Objective-C

@interface AWSIoTMQTTConfiguration : NSObject

/**
 The time in seconds to wait before attempting the first reconnect.  If the MQTT client
 becomes disconnected, it will attempt to reconnect after a quiet period; this quiet
 period doubles with each failed connection attempt, e.g. 1 second, 2 seconds, 4, 8,
 16, 32, etc... up until a maximum reconnection time (maximumReconnectTimeInterval) is 
 reached.  If a connection is active for the minimum connection time 
 (minimumConnectionTimeInterval), the quiet period is reset to the initial value.  
 Default value: 1 second.
  */
@property(nonatomic, assign, readonly) NSTimeInterval baseReconnectTimeInterval;

/**
 The time in seconds that a connection must be active before resetting
 the current reconnection time to the base reconnection time.  Default value:
 20 seconds.
 */
@property(nonatomic, assign, readonly) NSTimeInterval minimumConnectionTimeInterval;

/**
 The maximum time in seconds to wait prior to attempting to reconnect.  Default value:
 128 seconds.
 */
@property(nonatomic, assign, readonly) NSTimeInterval maximumReconnectTimeInterval;

/**
 The MQTT keep-alive time in seconds.  Default value: 300 seconds.
 */
@property(nonatomic, assign, readonly) NSTimeInterval keepAliveTimeInterval;

/**
 The last will and testament (LWT) to be used when connecting to AWS IoT; in the event
 that this client disconnects improperly, AWS IoT will use this to notify any interested
 clients.  Default value: nil
 */
@property(atomic, strong, readonly) AWSIoTMQTTLastWillAndTestament *lastWillAndTestament;

/**
 The run loop to execute the MQTT client in.  Default value: [NSRunLoop currentRunLoop]
 */
@property(atomic, strong, readonly) NSRunLoop *runLoop;

/**
 The run loop mode to use when executing the MQTT client.  Default value: NSDefaultRunLoopMode
 */
@property(nonatomic, strong, readonly) NSString *runLoopMode;

/**
 Boolean flag to indicate whether auto-resubscribe feature is enabled. Default value: YES
 When enabled, in the event of abnormal network disconnection, the sdk automatically
 subscribes to previously subscribed topics.
 */
@property(nonatomic, assign, readonly) BOOL autoResubscribe;

/**
 The max number of publish messages to retry per second if the pub-ack is not received within 60 seconds
 **/
@property(nonatomic, assign, readonly) NSUInteger publishRetryThrottle;

/**
 MQTT username used to construct the MQTT username field for enhanced custom authentication use case:
 https://docs.aws.amazon.com/iot/latest/developerguide/enhanced-custom-auth-using.html#enhanced-custom-auth-using-mqtt
 **/
@property (nonatomic, copy) NSString *username;

/**
 MQTT password used for the MQTT password field for enhanced custom authentication use case:
 https://docs.aws.amazon.com/iot/latest/developerguide/enhanced-custom-auth-using.html#enhanced-custom-auth-using-mqtt
 **/
@property (nonatomic, copy) NSString *password;


/**
 Create an AWSIoTMQTTConfiguration object and initialize its parameters.
 The AWSIoTMQTTConfiguration object is then passed to AWSIoTDataManager to initialize it.
 Note, clients need to either specify all parameters explicitly or not customize any
 parameter in which case default parameter values will be used to initialize
 AWSIoTMqttConfiguration.
 
 @param kat     keepAliveTimeInterval, Mqtt Keep Alive time in seconds
 
 @param brt     baseReconnectTimeInterval, The time in seconds to wait before attempting
                the first reconnect
 
 @param mct     minimumConnectionTimeInterval, The time in seconds that a connection
                must be active before resetting the current reconnection time to the
                base reconnection time.
 
 @param mrt     maximumReconnectTimeInterval, The maximum time in seconds to wait prior
                to attempting to reconnect
 
 @param rlp     The run loop to execute the MQTT client in
 
 @param rlm     The run loop mode to use when executing the MQTT client
 
 @param ars     autoResubscribe, Boolean flag to indicate whether auto-resubscribe
                feature is enabled
 
 @param lwt     lastWillAndTestament, The last will and testament (LWT) to be used
                when connecting to AWS IoT
 */
- (instancetype)initWithKeepAliveTimeInterval:(NSTimeInterval)kat
                    baseReconnectTimeInterval:(NSTimeInterval)brt
                minimumConnectionTimeInterval:(NSTimeInterval)mct
                 maximumReconnectTimeInterval:(NSTimeInterval)mrt
                                      runLoop:(NSRunLoop*)rlp
                                  runLoopMode:(NSString*)rlm
                              autoResubscribe:(BOOL)ars
                         lastWillAndTestament:(AWSIoTMQTTLastWillAndTestament*)lwt;

/**
 Create an AWSIoTMQTTConfiguration object and initialize its parameters.
 The AWSIoTMQTTConfiguration object is then passed to AWSIoTDataManager to initialize it.
 Note, clients need to either specify all parameters explicitly or not customize any
 parameter in which case default parameter values will be used to initialize
 AWSIoTMqttConfiguration.
 
 @param kat     keepAliveTimeInterval, Mqtt Keep Alive time in seconds
 
 @param brt     baseReconnectTimeInterval, The time in seconds to wait before attempting
 the first reconnect
 
 @param mct     minimumConnectionTimeInterval, The time in seconds that a connection
 must be active before resetting the current reconnection time to the
 base reconnection time.
 
 @param mrt     maximumReconnectTimeInterval, The maximum time in seconds to wait prior
 to attempting to reconnect
 
 @param rlp     The run loop to execute the MQTT client in
 
 @param rlm     The run loop mode to use when executing the MQTT client
 
 @param ars     autoResubscribe, Boolean flag to indicate whether auto-resubscribe
 feature is enabled
 
 @param lwt     lastWillAndTestament, The last will and testament (LWT) to be used
 when connecting to AWS IoT
 
 @param prt     publishRetryThrottle, the max number of publish messages to retry per second
 if the pub-ack is not received within 60 seconds
 */
- (instancetype)initWithKeepAliveTimeInterval:(NSTimeInterval)kat
                    baseReconnectTimeInterval:(NSTimeInterval)brt
                minimumConnectionTimeInterval:(NSTimeInterval)mct
                 maximumReconnectTimeInterval:(NSTimeInterval)mrt
                                      runLoop:(NSRunLoop*)rlp
                                  runLoopMode:(NSString*)rlm
                              autoResubscribe:(BOOL)ars
                         lastWillAndTestament:(AWSIoTMQTTLastWillAndTestament*)lwt
                         publishRetryThrottle:(NSUInteger)prt;
@end

Swift

class AWSIoTMQTTConfiguration : NSObject

Undocumented

  • The time in seconds to wait before attempting the first reconnect. If the MQTT client becomes disconnected, it will attempt to reconnect after a quiet period; this quiet period doubles with each failed connection attempt, e.g. 1 second, 2 seconds, 4, 8, 16, 32, etc… up until a maximum reconnection time (maximumReconnectTimeInterval) is reached. If a connection is active for the minimum connection time (minimumConnectionTimeInterval), the quiet period is reset to the initial value.
    Default value: 1 second.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval baseReconnectTimeInterval;

    Swift

    var baseReconnectTimeInterval: TimeInterval { get }
  • The time in seconds that a connection must be active before resetting the current reconnection time to the base reconnection time. Default value: 20 seconds.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval minimumConnectionTimeInterval;

    Swift

    var minimumConnectionTimeInterval: TimeInterval { get }
  • The maximum time in seconds to wait prior to attempting to reconnect. Default value: 128 seconds.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval maximumReconnectTimeInterval;

    Swift

    var maximumReconnectTimeInterval: TimeInterval { get }
  • The MQTT keep-alive time in seconds. Default value: 300 seconds.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval keepAliveTimeInterval;

    Swift

    var keepAliveTimeInterval: TimeInterval { get }
  • The last will and testament (LWT) to be used when connecting to AWS IoT; in the event that this client disconnects improperly, AWS IoT will use this to notify any interested clients. Default value: nil

    Declaration

    Objective-C

    @property (strong, readonly) AWSIoTMQTTLastWillAndTestament *_Nonnull lastWillAndTestament;

    Swift

    var lastWillAndTestament: AWSIoTMQTTLastWillAndTestament { get }
  • The run loop to execute the MQTT client in. Default value: [NSRunLoop currentRunLoop]

    Declaration

    Objective-C

    @property (strong, readonly) NSRunLoop *_Nonnull runLoop;

    Swift

    var runLoop: RunLoop { get }
  • The run loop mode to use when executing the MQTT client. Default value: NSDefaultRunLoopMode

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSString *_Nonnull runLoopMode;

    Swift

    var runLoopMode: String { get }
  • Boolean flag to indicate whether auto-resubscribe feature is enabled. Default value: YES When enabled, in the event of abnormal network disconnection, the sdk automatically subscribes to previously subscribed topics.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL autoResubscribe;

    Swift

    var autoResubscribe: Bool { get }
  • The max number of publish messages to retry per second if the pub-ack is not received within 60 seconds *

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger publishRetryThrottle;

    Swift

    var publishRetryThrottle: UInt { get }
  • MQTT username used to construct the MQTT username field for enhanced custom authentication use case: https://docs.aws.amazon.com/iot/latest/developerguide/enhanced-custom-auth-using.html#enhanced-custom-auth-using-mqtt *

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull username;

    Swift

    var username: String { get set }
  • MQTT password used for the MQTT password field for enhanced custom authentication use case: https://docs.aws.amazon.com/iot/latest/developerguide/enhanced-custom-auth-using.html#enhanced-custom-auth-using-mqtt *

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull password;

    Swift

    var password: String { get set }
  • Create an AWSIoTMQTTConfiguration object and initialize its parameters. The AWSIoTMQTTConfiguration object is then passed to AWSIoTDataManager to initialize it. Note, clients need to either specify all parameters explicitly or not customize any parameter in which case default parameter values will be used to initialize AWSIoTMqttConfiguration.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithKeepAliveTimeInterval:(NSTimeInterval)kat
            baseReconnectTimeInterval:(NSTimeInterval)brt
        minimumConnectionTimeInterval:(NSTimeInterval)mct
         maximumReconnectTimeInterval:(NSTimeInterval)mrt
                              runLoop:(nonnull NSRunLoop *)rlp
                          runLoopMode:(nonnull NSString *)rlm
                      autoResubscribe:(BOOL)ars
                 lastWillAndTestament:(nonnull AWSIoTMQTTLastWillAndTestament *)lwt;

    Swift

    init(keepAliveTimeInterval kat: TimeInterval, baseReconnectTimeInterval brt: TimeInterval, minimumConnectionTimeInterval mct: TimeInterval, maximumReconnectTimeInterval mrt: TimeInterval, runLoop rlp: RunLoop, runLoopMode rlm: String, autoResubscribe ars: Bool, lastWillAndTestament lwt: AWSIoTMQTTLastWillAndTestament)

    Parameters

    kat

    keepAliveTimeInterval, Mqtt Keep Alive time in seconds

    brt

    baseReconnectTimeInterval, The time in seconds to wait before attempting the first reconnect

    mct

    minimumConnectionTimeInterval, The time in seconds that a connection must be active before resetting the current reconnection time to the base reconnection time.

    mrt

    maximumReconnectTimeInterval, The maximum time in seconds to wait prior to attempting to reconnect

    rlp

    The run loop to execute the MQTT client in

    rlm

    The run loop mode to use when executing the MQTT client

    ars

    autoResubscribe, Boolean flag to indicate whether auto-resubscribe feature is enabled

    lwt

    lastWillAndTestament, The last will and testament (LWT) to be used when connecting to AWS IoT

  • Create an AWSIoTMQTTConfiguration object and initialize its parameters. The AWSIoTMQTTConfiguration object is then passed to AWSIoTDataManager to initialize it. Note, clients need to either specify all parameters explicitly or not customize any parameter in which case default parameter values will be used to initialize AWSIoTMqttConfiguration.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithKeepAliveTimeInterval:(NSTimeInterval)kat
            baseReconnectTimeInterval:(NSTimeInterval)brt
        minimumConnectionTimeInterval:(NSTimeInterval)mct
         maximumReconnectTimeInterval:(NSTimeInterval)mrt
                              runLoop:(nonnull NSRunLoop *)rlp
                          runLoopMode:(nonnull NSString *)rlm
                      autoResubscribe:(BOOL)ars
                 lastWillAndTestament:(nonnull AWSIoTMQTTLastWillAndTestament *)lwt
                 publishRetryThrottle:(NSUInteger)prt;

    Swift

    init(keepAliveTimeInterval kat: TimeInterval, baseReconnectTimeInterval brt: TimeInterval, minimumConnectionTimeInterval mct: TimeInterval, maximumReconnectTimeInterval mrt: TimeInterval, runLoop rlp: RunLoop, runLoopMode rlm: String, autoResubscribe ars: Bool, lastWillAndTestament lwt: AWSIoTMQTTLastWillAndTestament, publishRetryThrottle prt: UInt)

    Parameters

    kat

    keepAliveTimeInterval, Mqtt Keep Alive time in seconds

    brt

    baseReconnectTimeInterval, The time in seconds to wait before attempting the first reconnect

    mct

    minimumConnectionTimeInterval, The time in seconds that a connection must be active before resetting the current reconnection time to the base reconnection time.

    mrt

    maximumReconnectTimeInterval, The maximum time in seconds to wait prior to attempting to reconnect

    rlp

    The run loop to execute the MQTT client in

    rlm

    The run loop mode to use when executing the MQTT client

    ars

    autoResubscribe, Boolean flag to indicate whether auto-resubscribe feature is enabled

    lwt

    lastWillAndTestament, The last will and testament (LWT) to be used when connecting to AWS IoT

    prt

    publishRetryThrottle, the max number of publish messages to retry per second if the pub-ack is not received within 60 seconds