You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/AWSMQTT.jl
+49-39Lines changed: 49 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,16 @@
1
+
const subscribe_callback_docs ="Callback invoked when message received. See [`OnMessage`](@ref) for the required signature."
2
+
const subscribe_qos_docs ="Maximum requested QoS that server may use when sending messages to the client. The server may grant a lower QoS in the SUBACK (see returned task)."
3
+
const subscribe_return_docs ="""Returns a task and the ID of the SUBSCRIBE packet.
4
+
The task completes when a SUBACK is received from the server.
5
+
6
+
If successful, the task will contain a dict with the following members:
7
+
- `:packet_id (Int)`: ID of the SUBSCRIBE packet being acknowledged.
8
+
- `:topic (String)`: Topic filter of the SUBSCRIBE packet being acknowledged.
9
+
- `:qos (aws_mqtt_qos)`: Maximum QoS that was granted by the server. This may be lower than the requested QoS.
10
+
11
+
If unsuccessful, the task contains an exception."""
12
+
13
+
1
14
"""
2
15
MQTTClient(
3
16
tls_ctx::Union{ClientTLSContext,Nothing},
@@ -76,7 +89,7 @@ Arguments:
76
89
- `topic (String)`: Topic receiving message.
77
90
- `payload (String)`: Payload of message.
78
91
- `dup (Bool)`: DUP flag. If True, this might be re-delivery of an earlier attempt to send the message.
79
-
- `qos (aws_mqtt_qos)`: Quality of Service used to deliver the message.
92
+
- `qos (aws_mqtt_qos)`: $subscribe_qos_docs
80
93
- `retain (Bool)`: Retain flag. If `true`, the message was sent as a result of a new subscription being made by the client.
81
94
82
95
Returns `nothing`.
@@ -561,20 +574,12 @@ Once subscribed, `callback` is invoked each time a message matching the `topic`
561
574
possible for such messages to arrive before the SUBACK is received.
562
575
563
576
Arguments:
564
-
- `connection`: Connection to use.
565
-
- `topic`: Subscribe to this topic filter, which may include wildcards.
566
-
- `qos`: Maximum requested QoS that server may use when sending messages to the client. The server may grant a lower QoS in the SUBACK (see returned task).
567
-
- `callback`: Optional callback invoked when message received. See [`OnMessage`](@ref) for the required signature.
568
-
569
-
Returns a task and the ID of the SUBSCRIBE packet.
570
-
The task completes when a SUBACK is received from the server.
571
-
572
-
If successful, the task will contain a dict with the following members:
573
-
- `:packet_id (Int)`: ID of the SUBSCRIBE packet being acknowledged.
574
-
- `:topic (String)`: Topic filter of the SUBSCRIBE packet being acknowledged.
575
-
- `:qos (aws_mqtt_qos)`: Maximum QoS that was granted by the server. This may be lower than the requested QoS.
577
+
- `connection (MQTTConnection)`: Connection to use.
578
+
- `topic (String)`: Subscribe to this topic filter, which may include wildcards.
on_message_fcb = ForeignCallbacks.ForeignCallback{OnMessageMsg}() do msg
@@ -653,8 +658,8 @@ end
653
658
Set callback to be invoked when ANY message is received.
654
659
655
660
Arguments:
656
-
- `connection`: Connection to use.
657
-
- `callback`: Optional callback invoked when message received. See [`OnMessage`](@ref) for the required signature. Set to `nothing` to clear this callback.
661
+
- `connection (MQTTConnection)`: Connection to use.
662
+
- `callback (Union{OnMessage,Nothing})`: Optional callback invoked when message received. See [`OnMessage`](@ref) for the required signature. Set to `nothing` to clear this callback.
658
663
659
664
Returns nothing.
660
665
"""
@@ -728,23 +733,25 @@ function on_unsubscribe_complete(
728
733
returnnothing
729
734
end
730
735
736
+
const unsubscribe_return_docs ="""Returns a task and the ID of the UNSUBSCRIBE packet.
737
+
The task completes when an UNSUBACK is received from the server.
738
+
739
+
If successful, the task will contain a dict with the following members:
740
+
- `:packet_id (Int)`: ID of the UNSUBSCRIBE packet being acknowledged.
741
+
742
+
If unsuccessful, the task will throw an exception."""
If the device is offline, the PUBLISH packet will be sent once the connection resumes.
986
-
987
-
Arguments:
988
-
- `connection`: Connection to use.
989
-
- `topic`: Topic name.
990
-
- `payload`: Contents of message.
991
-
- `qos`: Quality of Service for delivering this message.
992
-
- `retain`: If `true`, the server will store the message and its QoS so that it can be delivered to future subscribers whose subscriptions match its topic name.
993
-
988
+
const publish_return_docs ="""
994
989
Returns a task and the ID of the PUBLISH packet.
995
990
The QoS determines when the task completes:
996
991
- For QoS 0, completes as soon as the packet is sent.
@@ -1000,7 +995,22 @@ The QoS determines when the task completes:
1000
995
If successful, the task will contain a dict with the following members:
1001
996
- `:packet_id (Int)`: ID of the PUBLISH packet that is complete.
1002
997
1003
-
If unsuccessful, the task will throw an exception.
998
+
If unsuccessful, the task will throw an exception."""
If the device is offline, the PUBLISH packet will be sent once the connection resumes.
1005
+
1006
+
Arguments:
1007
+
- `connection (MQTTConnection)`: Connection to use.
1008
+
- `topic (String)`: Topic name.
1009
+
- `payload (String)`: Contents of message.
1010
+
- `qos (aws_mqtt_qos)`: $subscribe_qos_docs
1011
+
- `retain (Bool)`: If `true`, the server will store the message and its QoS so that it can be delivered to future subscribers whose subscriptions match its topic name.
0 commit comments