{"result":{"depiction_url":null,"edges":{"subject":{"objects":[{"created":"2026-09-30T09:11:24Z","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:24Z","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:24Z","object_id":{"id":2598,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_messaging_and_pubsub","title":"Messaging and publish-subscribe","uri":"https:\/\/zotonic.com\/id\/2598"},"seq":3},{"created":"2026-09-30T09:11:24Z","object_id":{"id":2625,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_model","title":"Model","uri":"https:\/\/zotonic.com\/id\/2625"},"seq":4},{"created":"2026-09-30T09:11:24Z","object_id":{"id":2673,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_javascript","title":"JavaScript","uri":"https:\/\/zotonic.com\/id\/2673"},"seq":5},{"created":"2026-09-30T09:11:24Z","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":2744,"is_a":["text","documentation","reference","cotonic_reference","cotonic_model"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2744"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_cotonic_model_dedup","page_url":{"en":"https:\/\/zotonic.com\/cotonic\/models\/dedup","x-default":"https:\/\/zotonic.com\/cotonic\/models\/dedup"},"preview_url":null,"resource":{"version":15,"pivot_location_lat":null,"title":"model\/dedup","is_authoritative":true,"body":"<a name=\"model.dedup\"><\/a><h3>model.dedup<\/h3>\n            <p>The dedup model implements message deduplication. It works by sending a message to the dedup\n            model, the dedup model then relays the message to a topic with a response topic set to the\n            dedup model.<\/p>\n\n            <p>If a message is tried to be relayed before a message is received on the response topic then it will be\n            saved. Only the last saved message is stored. Any previously saved messages are overwritten.<\/p>\n\n            <p>If a message is received on the dedup response topic then that message will be relayed to the original\n            message&#39;s response topic (if any). If there is a saved message then that message will be relayed to\n            the saved message topic.<\/p>\n\n            <a name=\"model.dedup.post.message\"><\/a><h4>post\/message<\/h4><p>\n            Handles messages with the following payload:<\/p>\n<pre>\n{\n    topic: &quot;some\/topic&quot;,\n    payload: &quot;the message payload&quot;,\n    timeout: optionalTimeoutInMsec\n}\n<\/pre>\n            <p>\n                The payload will be published to the given topic. The timeout is optional and defaults to 15000 msec.\n                If there is no response to the dedup reponse topic within the timeout then the message is assumed to\n                be lost and any queued message or new message is allowed to be relayed.\n                <br \/>\n                The de-duplication is done by generating a key. The key is the concatenation of the topic and the response topic\n                of the message.\n            <\/p>\n<pre>\nself.publish(&quot;model\/dedup\/post\/message&quot;, { topic: &quot;hello\/there&quot;, payload: { a: 1 } })\n=&gt; De-duplicates messages to the <tt>hello\/there<\/tt> topic.\n<\/pre>\n\n            <a name=\"model.dedup.post.message.key\"><\/a><h4>post\/message\/+key<\/h4><p>\n            Exactly like <a href=\"\/id\/doc_cotonic_model_dedup#model.dedup.post.message\">post\/message<\/a> except that the deduplication key is\n            not generated from the topics but predefined. This enables to use deduplication in calls, where the\n            response topic is always unique.\n            <\/p>\n<pre>\nself.call(&quot;model\/dedup\/post\/message\/one-at-a-time&quot;, { topic: &quot;hello\/there&quot;, payload: { a: 1 } })\n.then( (msh) =&gt; console.log(msg) );\n=&gt; De-duplicates all messages using the <tt>one-at-a-time<\/tt> key.\n<\/pre>\n\n            <a name=\"model.dedup.event.ping\"><\/a><h4>event\/ping<\/h4><p>\n            When the dedup model is enabled a retained message is published\n            on the <tt>model\/dedup\/event\/ping<\/tt> topic.\n            <\/p>\n            <pre>\nlet dedupReady = false;\ncotonic.broker.subscribe(&quot;model\/dedup\/event\/+key&quot;,\n    function(msg, args) {\n        switch(args.key)\n        case &quot;pong&quot;:\n            dedupReady = true;\n            break;\n        ...\n    });\n=&gt; When the dedup model is ready a pong message will be available<\/pre>\n\n            ","slug":"model-dedup","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"374c87709e6982467aed152149491c44c8acd09d055cde563625377a14522b80","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":2723,"is_a":["meta","category"],"name":"cotonic_model","title":"Cotonic models","uri":"https:\/\/zotonic.com\/id\/cotonic_model"},"doc_source_path":"index.html","publication_start":"2026-09-30T09:11:24Z","page_path":"\/cotonic\/models\/dedup","github_url":"https:\/\/github.com\/cotonic\/cotonic\/blob\/master\/index.html","pivot_location_lng":null,"doc_source_kind":"cotonic","name":"doc_cotonic_model_dedup","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-09-30T09:11:24Z","uri":null,"doc_source_anchor":"model.dedup","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-30T09:57:32Z","title_slug":"model-dedup"},"uri":"https:\/\/zotonic.com\/id\/2744","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2744"}},"status":"ok"}