@@ -40,14 +40,28 @@ extension MQTTClient {
40
40
/// Configuration for MQTTClient
41
41
public struct Configuration {
42
42
/// Initialize MQTTClient configuration struct
43
+ /// - Parameters:
44
+ /// - version: Version of MQTT server client is connecting to
45
+ /// - disablePing: Disable the automatic sending of pingreq messages
46
+ /// - keepAliveInterval: MQTT keep alive period.
47
+ /// - pingInterval: Override calculated interval between each pingreq message
48
+ /// - connectTimeout: Timeout for connecting to server
49
+ /// - timeout: Timeout for server ACK responses
50
+ /// - userName: MQTT user name
51
+ /// - password: MQTT password
52
+ /// - useSSL: Use encrypted connection to server
53
+ /// - useWebSockets: Use a websocket connection to server
54
+ /// - tlsConfiguration: TLS configuration, for SSL connection
55
+ /// - sniServerName: Server name used by TLS. This will default to host name if not set
56
+ /// - webSocketURLPath: URL Path for web socket. Defaults to "/mqtt"
57
+ /// - webSocketMaxFrameSize: Maximum frame size for a web socket connection
43
58
public init (
44
59
version: Version = . v3_1_1,
45
60
disablePing: Bool = false ,
46
61
keepAliveInterval: TimeAmount = . seconds( 90 ) ,
47
62
pingInterval: TimeAmount ? = nil ,
48
63
connectTimeout: TimeAmount = . seconds( 10 ) ,
49
64
timeout: TimeAmount ? = nil ,
50
- maxRetryAttempts: Int = 4 ,
51
65
userName: String ? = nil ,
52
66
password: String ? = nil ,
53
67
useSSL: Bool = false ,
@@ -63,7 +77,58 @@ extension MQTTClient {
63
77
self . pingInterval = pingInterval
64
78
self . connectTimeout = connectTimeout
65
79
self . timeout = timeout
66
- self . maxRetryAttempts = maxRetryAttempts
80
+ self . userName = userName
81
+ self . password = password
82
+ self . useSSL = useSSL
83
+ self . useWebSockets = useWebSockets
84
+ self . tlsConfiguration = tlsConfiguration
85
+ self . sniServerName = sniServerName
86
+ self . webSocketURLPath = webSocketURLPath
87
+ self . webSocketMaxFrameSize = webSocketMaxFrameSize
88
+ }
89
+
90
+ /// Initialize MQTTClient configuration struct
91
+ /// - Parameters:
92
+ /// - version: Version of MQTT server client is connecting to
93
+ /// - disablePing: Disable the automatic sending of pingreq messages
94
+ /// - keepAliveInterval: MQTT keep alive period.
95
+ /// - pingInterval: Override calculated interval between each pingreq message
96
+ /// - connectTimeout: Timeout for connecting to server
97
+ /// - timeout: Timeout for server ACK responses
98
+ /// - maxRetryAttempts: Max number of times to send a message. This is deprecated
99
+ /// - userName: MQTT user name
100
+ /// - password: MQTT password
101
+ /// - useSSL: Use encrypted connection to server
102
+ /// - useWebSockets: Use a websocket connection to server
103
+ /// - tlsConfiguration: TLS configuration, for SSL connection
104
+ /// - sniServerName: Server name used by TLS. This will default to host name if not set
105
+ /// - webSocketURLPath: URL Path for web socket. Defaults to "/mqtt"
106
+ /// - webSocketMaxFrameSize: Maximum frame size for a web socket connection
107
+ ///
108
+ @available ( * , deprecated, message: " maxRetryAttempts is no longer used " )
109
+ public init (
110
+ version: Version = . v3_1_1,
111
+ disablePing: Bool = false ,
112
+ keepAliveInterval: TimeAmount = . seconds( 90 ) ,
113
+ pingInterval: TimeAmount ? = nil ,
114
+ connectTimeout: TimeAmount = . seconds( 10 ) ,
115
+ timeout: TimeAmount ? = nil ,
116
+ maxRetryAttempts: Int ,
117
+ userName: String ? = nil ,
118
+ password: String ? = nil ,
119
+ useSSL: Bool = false ,
120
+ useWebSockets: Bool = false ,
121
+ tlsConfiguration: TLSConfigurationType ? = nil ,
122
+ sniServerName: String ? = nil ,
123
+ webSocketURLPath: String ? = nil ,
124
+ webSocketMaxFrameSize: Int = 1 << 14
125
+ ) {
126
+ self . version = version
127
+ self . disablePing = disablePing
128
+ self . keepAliveInterval = keepAliveInterval
129
+ self . pingInterval = pingInterval
130
+ self . connectTimeout = connectTimeout
131
+ self . timeout = timeout
67
132
self . userName = userName
68
133
self . password = password
69
134
self . useSSL = useSSL
@@ -76,7 +141,7 @@ extension MQTTClient {
76
141
77
142
/// Version of MQTT server client is connecting to
78
143
public let version : Version
79
- /// disable the sending of pingreq messages
144
+ /// disable the automatic sending of pingreq messages
80
145
public let disablePing : Bool
81
146
/// MQTT keep alive period.
82
147
public let keepAliveInterval : TimeAmount
@@ -86,8 +151,6 @@ extension MQTTClient {
86
151
public let connectTimeout : TimeAmount
87
152
/// timeout for server response
88
153
public let timeout : TimeAmount ?
89
- /// max number of times to send a message
90
- public let maxRetryAttempts : Int
91
154
/// MQTT user name.
92
155
public let userName : String ?
93
156
/// MQTT password.
0 commit comments