{"result":{"depiction_url":null,"edges":{"subject":{"objects":[{"created":"2026-09-30T09:11:22Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-30T09:11:22Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-09-30T09:11:22Z","object_id":{"id":2655,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_publish_and_subscribe","title":"Publish and subscribe","uri":"https:\/\/zotonic.com\/id\/2655"},"seq":3},{"created":"2026-09-30T09:11:22Z","object_id":{"id":2673,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_javascript","title":"JavaScript","uri":"https:\/\/zotonic.com\/id\/2673"},"seq":4},{"created":"2026-09-30T09:11:22Z","object_id":{"id":2677,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_mqtt","title":"MQTT","uri":"https:\/\/zotonic.com\/id\/2677"},"seq":5},{"created":"2026-09-30T09:11:22Z","object_id":{"id":2718,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_cotonic","title":"Cotonic","uri":"https:\/\/zotonic.com\/id\/2718"},"seq":6}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2728,"is_a":["text","documentation","reference","cotonic_reference"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2728"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_cotonic_cotonic_mqtt","page_url":{"en":"https:\/\/zotonic.com\/cotonic\/cotonic_mqtt","x-default":"https:\/\/zotonic.com\/cotonic\/cotonic_mqtt"},"preview_url":null,"resource":{"version":16,"pivot_location_lat":null,"title":"cotonic.mqtt","is_authoritative":true,"body":"<a name=\"cotonic.mqtt\"><\/a>\n            <p>\n            The mqtt module provides functions to work with mqtt topics. The <a href=\"\/id\/doc_cotonic_cotonic_broker#cotonic.broker\">broker<\/a>\n            uses this module as the basis to provide its functionality. This module also has some utility functions\n            to easily extract information from topics.\n            <\/p>\n\n            <!-- More info needed, references to MQTT maybe? -->\n\n            <!-- matches -->\n            <a name=\"cotonic.mqtt.matches\"><\/a><h2>matches <code>cotonic.mqtt.matches(pattern, topic)<\/code><\/h2><p>\n            Returns <tt>true<\/tt> when the pattern matches the topic, <tt>false<\/tt> otherwise.\n            <\/p>\n            <pre>\ncotonic.mqtt.matches(&quot;truck\/+\/speed&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; true\ncotonic.mqtt.matches(&quot;boat\/+\/speed&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; false\ncotonic.mqtt.matches(&quot;+\/+\/speed&quot;, &quot;plane\/01\/speed&quot;);\n=&gt; true\ncotonic.mqtt.matches(&quot;+\/+\/speed&quot;, &quot;plane\/01\/height&quot;);\n=&gt; false<\/pre>\n\n            <!-- fill -->\n            <a name=\"cotonic.mqtt.fill\"><\/a><h2>fill <code>cotonic.mqtt.fill(pattern, params)<\/code><\/h2><p>\n            Fill can use a <tt>pattern<\/tt> topic, and use the <tt>param<\/tt> object to create\n            an mqtt topic. Returns a string with the created topic.\n            <\/p>\n            <pre>\ncotonic.mqtt.fill(&quot;truck\/+truck_id\/speed&quot;, {truck_id: 100});\n=&gt; &quot;truck\/100\/speed&quot;<\/pre>\n\n            <!-- extract -->\n            <a name=\"cotonic.mqtt.extract\"><\/a><h2>extract <code>cotonic.mqtt.extract(pattern, topic)<\/code><\/h2><p>\n            Extract values from <tt>topic<\/tt> into an object. The pattern <tt>+&lt;key&gt;<\/tt> matches\n            a single level of the topic path. It places an attribute <tt>key<\/tt> with as value the\n            found element in the path in the returned object. The pattern <tt>#&lt;key&gt;<\/tt>\n            matches a multi level path. When it is matched it places that part of the path into a list.\n            Returns an object with the found elements.\n            <\/p>\n            <pre>\ncotonic.mqtt.extract(&quot;truck\/+truck_id\/speed&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; {truck_id: &quot;01&quot;}\ncotonic.mqtt.extract(&quot;truck\/+truck_id\/#params&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; {truck_id: &quot;01&quot;, params: [&quot;speed&quot;]}<\/pre>\n\n            <!-- exec -->\n            <a name=\"cotonic.mqtt.exec\"><\/a><h2>exec <code>cotonic.mqtt.exec(pattern, topic)<\/code><\/h2><p>\n            When the <tt>pattern<\/tt> <a href=\"\/id\/doc_cotonic_cotonic_mqtt#cotonic.mqtt.matches\">matches<\/a> the <tt>topic<\/tt>,\n            <a href=\"\/id\/doc_cotonic_cotonic_mqtt#cotonic.mqtt.extract\">extract<\/a> the values from the topic. Returns the\n            extracted values when the pattern matches, <tt>null<\/tt> otherwise.<\/p>\n            <pre>\ncotonic.mqtt.exec(&quot;truck\/+truck_id\/speed&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; {truck_id: &quot;01&quot;}\ncotonic.mqtt.exec(&quot;boat\/+truck_id\/speed&quot;, &quot;truck\/01\/speed&quot;);\n=&gt; null<\/pre>\n\n            <!-- remove_named_wildcards -->\n            <a name=\"cotonic.mqtt.remove_named_wildcards\"><\/a><h2>remove_named_wildcards <code>cotonic.mqtt.remove_named_wildcards(pattern)<\/code><\/h2><p>\n            Remove the special, and non mqtt compliant, wildcards from the pattern and return a compliant\n            topic.\n            <\/p>\n            <pre>\ncotonic.mqtt.remove_named_wildcards(&quot;truck\/+truck_id\/speed&quot;);\n=&gt; &quot;truck\/+\/speed&quot;\ncotonic.mqtt.remove_named_wildcards(&quot;truck\/#truck_info&quot;);\n=&gt; &quot;truck\/#&quot;<\/pre>\n\n            <!-- MQTT Bridge -->\n            ","slug":"cotonic.mqtt","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"5bbc01944a043722ed0c1c86abfeba6645dba9a24e72754821abcaf0bc0373b3","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":2722,"is_a":["meta","category"],"name":"cotonic_reference","title":"Cotonic","uri":"https:\/\/zotonic.com\/id\/cotonic_reference"},"doc_source_path":"index.html","publication_start":"2026-09-30T09:11:22Z","page_path":"\/cotonic\/cotonic_mqtt","github_url":"https:\/\/github.com\/cotonic\/cotonic\/blob\/master\/index.html","pivot_location_lng":null,"doc_source_kind":"cotonic","name":"doc_cotonic_cotonic_mqtt","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-09-30T09:11:22Z","uri":null,"doc_source_anchor":"cotonic.mqtt","doc_status":"current","is_dependent":false,"publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"f88cc928b997d10f7f19e6bd0ede80e1c8c619bc","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-09-30T10:06:59Z","title_slug":"cotonic.mqtt"},"uri":"https:\/\/zotonic.com\/id\/2728","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2728"}},"status":"ok"}