<p>The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.</p>
<p>When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.</p>
<p>When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.</p>
<p>When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.</p>
<p>If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.</p>
<p>The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.</p>
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><spanid="addeventlistenerk"><spanclass="tsd-kind-type-parameter">K</span><spanclass="tsd-signature-keyword">extends</span><spanclass="tsd-signature-keyword">keyof</span><ahref="../types/_waku_sds.MessageChannelEvents.html"class="tsd-signature-type tsd-kind-type-alias">MessageChannelEvents</a></span></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">type</span>: <aclass="tsd-signature-type tsd-kind-type-parameter"href="#addeventlistenerk">K</a></span></li><li><span><spanclass="tsd-kind-parameter">listener</span>: <spanclass="tsd-signature-type">null</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">EventHandler</span><spanclass="tsd-signature-symbol"><</span><ahref="../types/_waku_sds.MessageChannelEvents.html"class="tsd-signature-type tsd-kind-type-alias">MessageChannelEvents</a><spanclass="tsd-signature-symbol">[</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="#addeventlistenerk">K</a><spanclass="tsd-signature-symbol">]</span><spanclass="tsd-signature-symbol">></span></span></li><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">options</span>: <spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">AddEventListenerOptions</span></span></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><p>Inherited from TypedEventEmitter.addEventListener</p><ul><li>Defined in node_modules/main-event/dist/src/index.d.ts:89</li></ul></aside></div></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3class="tsd-anchor-link"id="dispatchevent"><span>dispatch<wbr/>Event</span><ahref="#dispatchevent"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-is-inherited tsd-is-external"><divclass="tsd-signature tsd-anchor-link"id="dispatchevent-1"><spanclass="tsd-kind-call-signature">dispatchEvent</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">event</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">Event</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">boolean</span><ahref="#dispatchevent-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></div><divclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.</p>
</div></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/049e564e89a68f0d5c6d103b1e5ff7a79b6ef50e/packages/sds/src/message_channel/message_channel.ts#L166">packages/sds/src/message_channel/message_channel.ts:166</a></li></ul></aside></div></li></ul></section><sectionclass="tsd-panel tsd-member"><h3class="tsd-anchor-link"id="pushincomingmessage"><span>push<wbr/>Incoming<wbr/>Message</span><ahref="#pushincomingmessage"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass=""><divclass="tsd-signature tsd-anchor-link"id="pushincomingmessage-1"><spanclass="tsd-kind-call-signature">pushIncomingMessage</span><spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">message</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.Message.html"class="tsd-signature-type tsd-kind-class">Message</a><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-kind-parameter">retrievalHint</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">undefined</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">Uint8Array</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">ArrayBufferLike</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">void</span><ahref="#pushincomingmessage-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></div><divclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Queues a received message for processing.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">message</span>: <ahref="_waku_sds.Message.html"class="tsd-signature-type tsd-kind-class">Message</a></span><divclass="tsd-comment tsd-typography"><p>The message to receive and process</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><spanclass="tsd-kind-parameter">retrievalHint</span>: <spanclass="tsd-signature-type">undefined</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">Uint8Array</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">ArrayBufferLike</span><spanclass="tsd-signature-symbol">></span></span><divclass="tsd-comment tsd-typography"><p>The retrieval hint for the message, provided by the transport layer</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><divclass="tsd-comment tsd-typography"><divclass="tsd-tag-example"><h4class="tsd-anchor-link"id="example-1">Example<ahref="#example-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><codeclass="typescript"><spanclass="hl-4">const</span><spanclass="hl-1"></span><spanclass="hl-7">channel</span><spanclass="hl-1"> = </span><spanclass="hl-4">new</span><spanclass="hl-1"></span><spanclass="hl-0">MessageChannel</span><spanclass="hl-1">(</span><spanclass="hl-2">"chat-room"</span><spanclass="hl-1">);</span><br/><br/><spanclass="hl-3">// Receive a message from the network</span><br/><spanclass="hl-5">channel</span><spanclass="hl-1">.</span><spanclass="hl-0">pushIncomingMessage</span><spanclass="hl-1">(</span><spanclass="hl-5">incomingMessage</span><spanclass="hl-1">);</span><br/><br/><spanclass="hl-3">// Process the received message</span><br/><spanclass="hl-8">await</span><spanclass="hl-1"></span><spanclass="hl-5">channel</span><spanclass="hl-1">.</span><spanclass="hl-0">processTasks</span><spanclass="hl-1">();</span>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">callback</span>: <spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">processedMessage</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.Message.html"class="tsd-signature-type tsd-kind-class">Message</a><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span></span><divclass="tsd-comment tsd-typography"><p>A callback function that returns a boolean indicating whether the message was sent successfully.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">void</span><spanclass="tsd-signature-symbol">></span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/049e564e89a68f0d5c6d103b1e5ff7a79b6ef50e/packages/sds/src/message_channel/message_channel.ts#L237">packages/sds/src/message_channel/message_channel.ts:237</a></li></ul></aside></div></li></ul></section><sectionclass="tsd-panel tsd-member"><h3class="tsd-anchor-link"id="pushoutgoingmessage"><span>push<wbr/>Outgoing<wbr/>Message</span><ahref="#pushoutgoingmessage"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass=""><divclass="tsd-signature tsd-anchor-link"id="pushoutgoingmessage-1"><spanclass="tsd-kind-call-signature">pushOutgoingMessage</span><spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">payload</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">Uint8Array</span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-kind-parameter">callback</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">processedMessage</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.ContentMessage.html"class="tsd-signature-type tsd-kind-class">ContentMessage</a><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><br/><spanclass="tsd-signature-symbol">{</span><spanclass="tsd-kind-property">retrievalHint</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-type">Uint8Array</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">ArrayBufferLike</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">;</span><spanclass="tsd-kind-property">success</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">}</span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">void</span><ahref="#pushoutgoingmessage-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></div><divclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Queues a message to be sent on this channel.</p>
<p>The message will be processed sequentially when processTasks() is called.
This ensures proper lamport timestamp ordering and causal history tracking.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">payload</span>: <spanclass="tsd-signature-type">Uint8Array</span></span><divclass="tsd-comment tsd-typography"><p>The message content as a byte array</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">callback</span>: <spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">processedMessage</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.ContentMessage.html"class="tsd-signature-type tsd-kind-class">ContentMessage</a><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><br/><spanclass="tsd-signature-symbol">{</span><spanclass="tsd-kind-property">retrievalHint</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-type">Uint8Array</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">ArrayBufferLike</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">;</span><spanclass="tsd-kind-property">success</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">}</span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">></span></span><divclass="tsd-comment tsd-typography"><p>callback function that should propagate the message
on the routing layer; <code>success</code> should be false if sending irremediably fails,
when set to true, the message is finalized into the channel locally.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">void</span></h4><p>Promise that resolves when the message is queued (not sent)</p>
</div><divclass="tsd-tag-throws"><h4class="tsd-anchor-link"id="throws">Throws<ahref="#throws"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if the payload is empty</p>
</div></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/049e564e89a68f0d5c6d103b1e5ff7a79b6ef50e/packages/sds/src/message_channel/message_channel.ts#L205">packages/sds/src/message_channel/message_channel.ts:205</a></li></ul></aside></div></li></ul></section><sectionclass="tsd-panel tsd-member"><h3class="tsd-anchor-link"id="pushoutgoingsyncmessage"><span>push<wbr/>Outgoing<wbr/>Sync<wbr/>Message</span><ahref="#pushoutgoingsyncmessage"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures"><liclass=""><divclass="tsd-signature tsd-anchor-link"id="pushoutgoingsyncmessage-1"><spanclass="tsd-kind-call-signature">pushOutgoingSyncMessage</span><spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">callback</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">message</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.SyncMessage.html"class="tsd-signature-type tsd-kind-class">SyncMessage</a><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span><ahref="#pushoutgoingsyncmessage-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></div><divclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Send a sync message to the SDS channel.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">callback</span>: <spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">message</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.SyncMessage.html"class="tsd-signature-type tsd-kind-class">SyncMessage</a><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span></span><divclass="tsd-comment tsd-typography"><p>A callback function that returns a boolean indicating whether the message was sent successfully.</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span></h4><divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/049e564e89a68f0d5c6d103b1e5ff7a79b6ef50e/packages/sds/src/message_channel/message_channel.ts#L431">packages/sds/src/message_channel/message_channel.ts:431</a></li></ul></aside></div></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3class="tsd-anchor-link"id="removeeventlistener"><span>remove<wbr/>Event<wbr/>Listener</span><ahref="#removeeventlistener"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited tsd-is-external"><liclass="tsd-is-inherited tsd-is-external"><divclass="tsd-signature tsd-anchor-link"id="removeeventlistener-1"><spanclass="tsd-kind-call-signature">removeEventListener</span><spanclass="tsd-signature-symbol"><</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="#removeeventlistenerk">K</a><spanclass="tsd-signature-keyword">extends</span><spanclass="tsd-signature-keyword">keyof</span><ahref="../types/_waku_sds.MessageChannelEvents.html"class="tsd-signature-type tsd-kind-type-alias">MessageChannelEvents</a><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><br/><spanclass="tsd-kind-parameter">type</span><spanclass="tsd-signature-symbol">:</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="#removeeventlistenerk">K</a><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-kind-parameter">listener</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-type">null</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">EventHandler</span><spanclass="tsd-signature-symbol"><</span><ahref="../types/_waku_sds.MessageChannelEvents.html"class="tsd-signature-type tsd-kind-type-alias">MessageChannelEvents</a><spanclass="tsd-signature-symbol">[</span><aclass="tsd-signature-type tsd-kind-type-parameter"href="#removeeventlistenerk">K</a><spanclass="tsd-signature-symbol">]</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-kind-parameter">options</span><spanclass="tsd-signature-symbol">?:</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">|</span><spanclass="tsd-signature-type">EventListenerOptions</span><spanclass="tsd-signature-symbol">,</span><br/><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">void</span><ahref="#removeeventlistener-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"aria-hidden="true"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></div><divclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Removes the event listener in target's event listener list with the same type, callback, and options.</p>
</div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">HistoryEntry</span><spanclass="tsd-signature-symbol">[]</span></h4><p>Array of history entries for messages still missing dependencies</p>
Per SDS-R spec: periodically check for repair responses that are due.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag">Optional</code><spanclass="tsd-kind-parameter">callback</span>: <spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">message</span><spanclass="tsd-signature-symbol">:</span><ahref="_waku_sds.Message.html"class="tsd-signature-type tsd-kind-class">Message</a><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">=></span><spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">boolean</span><spanclass="tsd-signature-symbol">></span></span><divclass="tsd-comment tsd-typography"><p>callback to rebroadcast the message</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">Promise</span><spanclass="tsd-signature-symbol"><</span><ahref="_waku_sds.Message.html"class="tsd-signature-type tsd-kind-class">Message</a><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">></span></h4><p>Promise that resolves when all ready repairs have been sent</p>