     public init(username: String, password: String) {
         self.username = username
         self.password = password
+    }
+}
+
+public struct MQTTPublishOpts {
+    public let max_inflight_messages: UInt32
+    public let message_retry: UInt32
+    
+    public init(max_inflight_messages: UInt32, message_retry: UInt32) {
+        self.max_inflight_messages = max_inflight_messages
+        self.message_retry = message_retry
     }
 }
 

    public var mqttReconnOpts: MQTTReconnOpts
    public var mqttWillOpts: MQTTWillOpts?
    public var mqttAuthOpts: MQTTAuthOpts?
    
    public var onConnectCallback: ((returnCode: Int) -> Void)?
    public var onDisconnectCallback: ((reasonCode: Int) -> Void)!

            mosquitto_username_pw_set(mosquittoContext.mosquittoHandler, mqttAuthOpts.username.cCharArray, mqttAuthOpts.password.cCharArray)
        }
        
        // set MQTT Publish Options
        if let mqttPublishOpts = mqttConfig.mqttPublishOpts {
            mosquitto_max_inflight_messages_set(mosquittoContext.mosquittoHandler, mqttPublishOpts.max_inflight_messages)
            mosquitto_message_retry_set(mosquittoContext.mosquittoHandler, mqttPublishOpts.message_retry)
        }
        
        // start MQTTClient
        let mqttClient = MQTTClient(mosquittoContext: mosquittoContext)
        let host = mqttConfig.host
