From 1947d39119d0cce8c64170527f064b2d70bff1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Mar=C4=8Deti=C4=87?= Date: Mon, 28 Jan 2019 14:36:29 +0100 Subject: [PATCH] MF-558 - Add MQTT subtopics documentation (#559) * Added MQTT subtopic's doc section Signed-off-by: nmarcetic * Resolving remarks Signed-off-by: nmarcetic * Resolving remarks Signed-off-by: nmarcetic * Resolved remarks Signed-off-by: nmarcetic --- docs/messaging.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/messaging.md b/docs/messaging.md index 8af806cf..69076a57 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -68,6 +68,27 @@ mosquitto_sub -u -P -t channels//messages -h If you are using TLS to secure MQTT connection, add `--cafile docker/ssl/certs/ca.crt` to every command. +###### Subtopics +In order to use MQTT subtopics and extend the channel with subtopic or name the channel using your own naming convention, You can simply add any suffix on base ` /channels//messages` topic. + +Example subtopic publish/subscribe for bedroom temperature would be + +`channels//messages/bedroom/temperature` + +Subtopics are generic and multilevel, You can use any prefix with any level depth. + +Topic with subtopics are propagated to NATS broker in the following format + +`channel..` + +Subscription directly to NATS on our example channel with subtopic + +`channels//messages/bedroom/temperature` would be in format `channel..bedroom.temperature` + + +For more information and examples checkout [official nats.io documentation](https://nats.io/documentation/writing_applications/subscribing/) + + ## CoAP CoAP adapter implements CoAP protocol using underlying UDP and according to [RFC 7252](https://tools.ietf.org/html/rfc7252). To send and receive messages over CoAP, you can use [Copper](https://github.com/mkovatsc/Copper) CoAP user-agent. To set the add-on, please follow the installation instructions provided [here](https://github.com/mkovatsc/Copper#how-to-integrate-the-copper-sources-into-firefox). Once the Mozilla Firefox and Copper are ready and CoAP adapter is running locally on the default port (5683), you can navigate to the appropriate URL and start using CoAP. The URL should look like this: @@ -84,4 +105,4 @@ The most of the notifications received from the Adapter are non-confirmable. By > Server must send a notification in a confirmable message instead of a non-confirmable message at least every 24 hours. This prevents a client that went away or is no longer interested from remaining in the list of observers indefinitely. -CoAP Adapter sends these notifications every 12 hours. To configure this period, please check [adapter documentation](../coap/README.md) If the client is no longer interested in receiving notifications, the second scenario described above can be used to unsubscribe \ No newline at end of file +CoAP Adapter sends these notifications every 12 hours. To configure this period, please check [adapter documentation](../coap/README.md) If the client is no longer interested in receiving notifications, the second scenario described above can be used to unsubscribe