Skip to content

Commit e3cbfcb

Browse files
authored
Update README.md (#79)
Explain the available connection settings and remove one of the limitations which is not an issue anymore.
1 parent ef4ab9e commit e3cbfcb

File tree

1 file changed

+71
-6
lines changed

1 file changed

+71
-6
lines changed

README.md

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,93 @@ The following is a complete list of options with their respective default:
135135

136136
```php
137137
$connectionSettings = (new \PhpMqtt\Client\ConnectionSettings)
138+
139+
// The username used for authentication when connecting to the broker.
138140
->setUsername(null)
141+
142+
// The password used for authentication when connecting to the broker.
139143
->setPassword(null)
144+
145+
// The connect timeout defines the maximum amount of seconds the client will try to establish
146+
// a socket connection with the broker. The value cannot be less than 1 second.
140147
->setConnectTimeout(60)
148+
149+
// The socket timeout is the maximum amount of idle time in seconds for the socket connection.
150+
// If no data is read or sent for the given amount of seconds, the socket will be closed.
151+
// The value cannot be less than 1 second.
141152
->setSocketTimeout(5)
142-
->setKeepAliveInterval(10)
153+
154+
// The resend timeout is the number of seconds the client will wait before sending a duplicate
155+
// of pending messages without acknowledgement. The value cannot be less than 1 second.
143156
->setResendTimeout(10)
157+
158+
// The keep alive interval is the number of seconds the client will wait without sending a message
159+
// until it sends a keep alive signal (ping) to the broker. The value cannot be less than 1 second
160+
// and may not be higher than 65535 seconds. A reasonable value is 10 seconds (the default).
161+
->setKeepAliveInterval(10)
162+
163+
// If the broker should publish a last will message in the name of the client when the client
164+
// disconnects abruptly, this setting defines the topic on which the message will be published.
165+
//
166+
// A last will message will only be published if both this setting as well as the last will
167+
// message are configured.
144168
->setLastWillTopic(null)
169+
170+
// If the broker should publish a last will message in the name of the client when the client
171+
// disconnects abruptly, this setting defines the message which will be published.
172+
//
173+
// A last will message will only be published if both this setting as well as the last will
174+
// topic are configured.
145175
->setLastWillMessage(null)
176+
177+
// The quality of service level the last will message of the client will be published with,
178+
// if it gets triggered.
146179
->setLastWillQualityOfService(0)
180+
181+
// This flag determines if the last will message of the client will be retained, if it gets
182+
// triggered. Using this setting can be handy to signal that a client is offline by publishing
183+
// a retained offline state in the last will and an online state as first message on connect.
147184
->setRetainLastWill(false)
185+
186+
// This flag determines if TLS should be used for the connection. The port which is used to
187+
// connect to the broker must support TLS connections.
148188
->setUseTls(false)
189+
190+
// This flag determines if the peer certificate is verified, if TLS is used.
149191
->setTlsVerifyPeer(true)
192+
193+
// This flag determines if the peer name is verified, if TLS is used.
150194
->setTlsVerifyPeerName(true)
195+
196+
// This flag determines if self signed certificates of the peer should be accepted.
197+
// Setting this to TRUE implies a security risk and should be avoided for production
198+
// scenarios and public services.
151199
->setTlsSelfSignedAllowed(false)
200+
201+
// The path to a Certificate Authority certificate which is used to verify the peer
202+
// certificate, if TLS is used.
152203
->setTlsCertificateAuthorityFile(null)
204+
205+
// The path to a directory containing Certificate Authority certificates which are
206+
// used to verify the peer certificate, if TLS is used.
153207
->setTlsCertificateAuthorityPath(null)
208+
209+
// The path to a client certificate file used for authentication, if TLS is used.
210+
//
211+
// The client certificate must be PEM encoded. It may optionally contain the
212+
// certificate chain of issuers.
154213
->setTlsClientCertificateFile(null)
214+
215+
// The path to a client certificate key file used for authentication, if TLS is used.
216+
//
217+
// This option requires ConnectionSettings::setTlsClientCertificateFile() to be used as well.
155218
->setTlsClientCertificateKeyFile(null)
219+
220+
// The passphrase used to decrypt the private key of the client certificate,
221+
// which in return is used for authentication, if TLS is used.
222+
//
223+
// This option requires ConnectionSettings::setTlsClientCertificateFile() and
224+
// ConnectionSettings::setTlsClientCertificateKeyFile() to be used as well.
156225
->setTlsClientCertificateKeyPassphrase(null);
157226
```
158227

@@ -187,11 +256,7 @@ $connectionSettings = (new \PhpMqtt\Client\ConnectionSettings)
187256
- [ ] Redis Driver
188257

189258
## Limitations
190-
191-
- There is no guarantee that message identifiers are not used twice (while the first usage is still pending).
192-
The current implementation uses a simple counter which resets after all 65535 identifiers were used.
193-
This means that as long as the client isn't used to an extent where acknowledgements are open for a very long time, you should be fine.
194-
This also only affects QoS levels higher than 0, as QoS level 0 is a simple fire and forget mode.
259+
195260
- Message flows with a QoS level higher than 0 are not persisted as the default implementation uses an in-memory repository for data.
196261
To avoid issues with broken message flows, use the clean session flag to indicate that you don't care about old data.
197262
It will not only instruct the broker to consider the connection new (without previous state), but will also reset the registered repository.

0 commit comments

Comments
 (0)