Skip to content

Commit 1b593ff

Browse files
authored
Update README for parameter changes
1 parent 6b10354 commit 1b593ff

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,19 @@ Create a client and connect to the MQTT broker.
1313
let client = MQTTClient(
1414
host: "mqtt.eclipse.org",
1515
port: 1883,
16+
identifier: "My Client",
1617
eventLoopGroupProvider: .createNew
1718
)
18-
let connect = MQTTConnectInfo(
19-
cleanSession: true,
20-
keepAliveSeconds: 15,
21-
clientIdentifier: identifier
22-
)
23-
try client.connect(info: connect).wait()
19+
try client.connect().wait()
2420
```
2521

2622
Subscribe to a topic and add a publish listener to report publish messages from the server.
2723
```swift
2824
let subscription = MQTTSubscribeInfo(
29-
qos: .atLeastOnce,
30-
topicFilter: "my-topics"
25+
topicFilter: "my-topics",
26+
qos: .atLeastOnce
3127
)
32-
try client.subscribe(infos: [subscription]).wait()
28+
try client.subscribe(to: [subscription]).wait()
3329
client.addPublishListener("My Listener") { result in
3430
switch result {
3531
case .success(let publish):
@@ -44,13 +40,11 @@ client.addPublishListener("My Listener") { result in
4440

4541
Publish to a topic.
4642
```swift
47-
let publish = MQTTPublishInfo(
48-
qos: .atLeastOnce,
49-
retain: false,
50-
topicName: "my-topics",
51-
payload: ByteBufferAllocator().buffer(string: "This is the Test payload")
52-
)
53-
try client.publish(info: publish).wait()
43+
try client.publish(
44+
to: "my-topics",
45+
payload: ByteBufferAllocator().buffer(string: "This is the Test payload"),
46+
qos: .atLeastOnce
47+
).wait()
5448
```
5549
## TLS
5650

@@ -68,6 +62,7 @@ let tlsConfiguration: TLSConfiguration? = TLSConfiguration.forClient(
6862
let client = MQTTClient(
6963
host: "test.mosquitto.org",
7064
port: 8884,
65+
identifier: "MySSLClient",
7166
eventLoopGroupProvider: .createNew,
7267
configuration: .init(useSSL: true, tlsConfiguration: tlsConfiguration),
7368
)

0 commit comments

Comments
 (0)