mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-02 13:53:12 +00:00
100 lines
60 KiB
HTML
100 lines
60 KiB
HTML
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WakuNode | Documentation</title><meta name="description" content="Documentation for Documentation"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Documentation</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/_waku_react.html">@waku/react</a></li><li><a href="" aria-current="page">WakuNode</a></li></ul><h1>Class WakuNode</h1></div><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/_waku_react.IWaku.html" class="tsd-signature-type tsd-kind-interface">IWaku</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:10</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h5 class="tsd-index-heading uppercase">Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="#events" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>events</span></a>
|
||
<a href="#filter" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>filter?</span></a>
|
||
<a href="#libp2p" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>libp2p</span></a>
|
||
<a href="#lightpush" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>light<wbr/>Push?</span></a>
|
||
<a href="#relay" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>relay?</span></a>
|
||
<a href="#store" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>store?</span></a>
|
||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Accessors</h3><div class="tsd-index-list"><a href="#health" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>health</span></a>
|
||
<a href="#peerid" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>peer<wbr/>Id</span></a>
|
||
<a href="#protocols" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>protocols</span></a>
|
||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="#createdecoder" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Decoder</span></a>
|
||
<a href="#createencoder" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Encoder</span></a>
|
||
<a href="#dial" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dial</span></a>
|
||
<a href="#getconnectedpeers" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Connected<wbr/>Peers</span></a>
|
||
<a href="#hangup" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>hang<wbr/>Up</span></a>
|
||
<a href="#isconnected" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Connected</span></a>
|
||
<a href="#isstarted" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Started</span></a>
|
||
<a href="#start" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</span></a>
|
||
<a href="#stop" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stop</span></a>
|
||
<a href="#waitforpeers" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Peers</span></a>
|
||
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Constructors</h2></summary><section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="constructor"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="constructorwakunode"><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">WakuNode</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.CreateNodeOptions.html" class="tsd-signature-type tsd-kind-type-alias">CreateNodeOptions</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">libp2p</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.Libp2p.html" class="tsd-signature-type tsd-kind-type-alias">Libp2p</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">protocolsEnabled</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ProtocolsEnabled</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">relay</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_react.IRelay.html" class="tsd-signature-type tsd-kind-type-alias">IRelay</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="" class="tsd-signature-type tsd-kind-class">WakuNode</a><a href="#constructorwakunode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../types/_waku_react.CreateNodeOptions.html" class="tsd-signature-type tsd-kind-type-alias">CreateNodeOptions</a></span></li><li><span><span class="tsd-kind-parameter">libp2p</span>: <a href="../types/_waku_react.Libp2p.html" class="tsd-signature-type tsd-kind-type-alias">Libp2p</a></span></li><li><span><span class="tsd-kind-parameter">protocolsEnabled</span>: <span class="tsd-signature-type">ProtocolsEnabled</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">relay</span>: <a href="../types/_waku_react.IRelay.html" class="tsd-signature-type tsd-kind-type-alias">IRelay</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="" class="tsd-signature-type tsd-kind-class">WakuNode</a></h4><aside class="tsd-sources"><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:23</li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Properties</h2></summary><section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="events"><code class="tsd-tag">Readonly</code><span>events</span><a href="#events" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">events</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.IWakuEventEmitter.html" class="tsd-signature-type tsd-kind-type-alias">IWakuEventEmitter</a></div><div class="tsd-comment tsd-typography"><p>Emits events related to the Waku node.
|
||
Those are:</p>
|
||
<ul>
|
||
<li>WakuEvent.Connection</li>
|
||
<li>WakuEvent.Health</li>
|
||
</ul>
|
||
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-5">events</span><span class="hl-1">.</span><span class="hl-0">addEventListener</span><span class="hl-1">(</span><span class="hl-5">WakuEvent</span><span class="hl-1">.</span><span class="hl-5">Connection</span><span class="hl-1">, (</span><span class="hl-5">event</span><span class="hl-1">) </span><span class="hl-4">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">detail</span><span class="hl-1">); </span><span class="hl-3">// true if connected, false if disconnected</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#events">events</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:16</li></ul></aside></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="filter"><code class="tsd-tag">Optional</code><span>filter</span><a href="#filter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">filter</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_react.IFilter.html" class="tsd-signature-type tsd-kind-type-alias">IFilter</a></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#filter">filter</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:14</li></ul></aside></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="libp2p"><span>libp2p</span><a href="#libp2p" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">libp2p</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.Libp2p.html" class="tsd-signature-type tsd-kind-type-alias">Libp2p</a></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#libp2p">libp2p</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:11</li></ul></aside></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="lightpush"><code class="tsd-tag">Optional</code><span>light<wbr/>Push</span><a href="#lightpush" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">lightPush</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_react.ILightPush.html" class="tsd-signature-type tsd-kind-type-alias">ILightPush</a></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#lightpush">lightPush</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:15</li></ul></aside></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="relay"><code class="tsd-tag">Optional</code><span>relay</span><a href="#relay" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">relay</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_react.IRelay.html" class="tsd-signature-type tsd-kind-type-alias">IRelay</a></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#relay">relay</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:12</li></ul></aside></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="store"><code class="tsd-tag">Optional</code><span>store</span><a href="#store" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">store</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_react.IStore.html" class="tsd-signature-type tsd-kind-type-alias">IStore</a></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#store">store</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:13</li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Accessors</h2></summary><section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="health"><span>health</span><a href="#health" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li><div class="tsd-signature" id="healthhealth"><span class="tsd-signature-keyword">get</span> <span class="tsd-kind-get-signature">health</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="../enums/_waku_react.HealthStatus.html" class="tsd-signature-type tsd-kind-enum">HealthStatus</a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>The health status can be one of three states:</p>
|
||
<ul>
|
||
<li>Unhealthy: No peer connections</li>
|
||
<li>MinimallyHealthy: At least 1 peer supporting both Filter and LightPush protocols</li>
|
||
<li>SufficientlyHealthy: At least 2 peers supporting both Filter and LightPush protocols</li>
|
||
</ul>
|
||
</div><h4 class="tsd-returns-title">Returns <a href="../enums/_waku_react.HealthStatus.html" class="tsd-signature-type tsd-kind-enum">HealthStatus</a></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-1">Example<a href="#example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-5">health</span><span class="hl-1">); </span><span class="hl-3">// 'Unhealthy'</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#health">health</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:26</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="peerid"><span>peer<wbr/>Id</span><a href="#peerid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li><div class="tsd-signature" id="peeridpeerid"><span class="tsd-signature-keyword">get</span> <span class="tsd-kind-get-signature">peerId</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a unique identifier for a node on the network.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PeerId</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-2">Example<a href="#example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-5">peerId</span><span class="hl-1">); </span><span class="hl-3">// 12D3KooWNmk9yXHfHJ4rUduRqD1TCTHkNFMPF9WP2dqWpZDL4aUb</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#peerid">peerId</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:24</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="protocols"><span>protocols</span><a href="#protocols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li><div class="tsd-signature" id="protocolsprotocols"><span class="tsd-signature-keyword">get</span> <span class="tsd-kind-get-signature">protocols</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns a list of supported protocols.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-3">Example<a href="#example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-5">protocols</span><span class="hl-1">); </span><span class="hl-3">// ['/ipfs/id/1.0.0', '/ipfs/ping/1.0.0', '/vac/waku/filter-push/2.0.0-beta1', '/vac/waku/metadata/1.0.0']</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#protocols">protocols</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:25</li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Methods</h2></summary><section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createdecoder"><span>create<wbr/>Decoder</span><a href="#createdecoder" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createdecoder-1"><span class="tsd-kind-call-signature">createDecoder</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">params</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.CreateDecoderParams.html" class="tsd-signature-type tsd-kind-type-alias">CreateDecoderParams</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/_waku_react.IDecoder.html" class="tsd-signature-type tsd-kind-interface">IDecoder</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_waku_react.IDecodedMessage.html" class="tsd-signature-type tsd-kind-interface">IDecodedMessage</a><span class="tsd-signature-symbol">></span><a href="#createdecoder-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a decoder for Waku messages on a specific content topic.</p>
|
||
<p>A decoder is used to decode messages from the Waku network format.
|
||
The decoder automatically handles shard configuration based on the Waku node's network settings.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">params</span>: <a href="../types/_waku_react.CreateDecoderParams.html" class="tsd-signature-type tsd-kind-type-alias">CreateDecoderParams</a></span><div class="tsd-comment tsd-typography"><p>Configuration for the decoder</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_waku_react.IDecoder.html" class="tsd-signature-type tsd-kind-interface">IDecoder</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/_waku_react.IDecodedMessage.html" class="tsd-signature-type tsd-kind-interface">IDecodedMessage</a><span class="tsd-signature-symbol">></span></h4><p>A decoder instance configured for the specified content topic</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link" id="throws">Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>If the shard configuration is incompatible with the node's network settings</p>
|
||
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-4">Example<a href="#example-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">// Create a decoder with default network shard settings</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">decoder</span><span class="hl-1"> = </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">createDecoder</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">contentTopic:</span><span class="hl-1"> </span><span class="hl-2">"/my-app/1/chat/proto"</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-3">// Create a decoder with custom shard settings</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">customDecoder</span><span class="hl-1"> = </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">createDecoder</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">contentTopic:</span><span class="hl-1"> </span><span class="hl-2">"/my-app/1/chat/proto"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">shardInfo:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">clusterId:</span><span class="hl-1"> </span><span class="hl-9">1</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">shard:</span><span class="hl-1"> </span><span class="hl-9">5</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#createdecoder">createDecoder</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:35</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="createencoder"><span>create<wbr/>Encoder</span><a href="#createencoder" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="createencoder-1"><span class="tsd-kind-call-signature">createEncoder</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">params</span><span class="tsd-signature-symbol">:</span> <a href="../types/_waku_react.CreateEncoderParams.html" class="tsd-signature-type tsd-kind-type-alias">CreateEncoderParams</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/_waku_react.IEncoder.html" class="tsd-signature-type tsd-kind-interface">IEncoder</a><a href="#createencoder-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates an encoder for Waku messages on a specific content topic.</p>
|
||
<p>An encoder is used to encode messages into the Waku network format.
|
||
The encoder automatically handles shard configuration based on the Waku node's network settings.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">params</span>: <a href="../types/_waku_react.CreateEncoderParams.html" class="tsd-signature-type tsd-kind-type-alias">CreateEncoderParams</a></span><div class="tsd-comment tsd-typography"><p>Configuration for the encoder including content topic and optionally shard information and ephemeral flag</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/_waku_react.IEncoder.html" class="tsd-signature-type tsd-kind-interface">IEncoder</a></h4><p>An encoder instance configured for the specified content topic</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link" id="throws-1">Throws<a href="#throws-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>If the shard configuration is incompatible with the node's network settings</p>
|
||
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-5">Example<a href="#example-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">// Create a basic encoder with default network shard settings</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">encoder</span><span class="hl-1"> = </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">createEncoder</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">contentTopic:</span><span class="hl-1"> </span><span class="hl-2">"/my-app/1/chat/proto"</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-3">// Create an ephemeral encoder (messages won't be stored by store nodes)</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-7">ephemeralEncoder</span><span class="hl-1"> = </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">createEncoder</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">contentTopic:</span><span class="hl-1"> </span><span class="hl-2">"/my-app/1/notifications/proto"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">ephemeral:</span><span class="hl-1"> </span><span class="hl-4">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">shardInfo:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">clusterId:</span><span class="hl-1"> </span><span class="hl-9">2</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">shardsUnderCluster:</span><span class="hl-1"> </span><span class="hl-9">16</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#createencoder">createEncoder</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:36</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="dial"><span>dial</span><a href="#dial" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="dial-1"><span class="tsd-kind-call-signature">dial</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">peer</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">MultiaddrInput</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">protocols</span><span class="tsd-signature-symbol">?:</span> <a href="../enums/_waku_react.Protocols.html" class="tsd-signature-type tsd-kind-enum">Protocols</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Stream</span><span class="tsd-signature-symbol">></span><a href="#dial-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Dials to the provided peer</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">peer</span>: <span class="tsd-signature-type">PeerId</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">MultiaddrInput</span></span><div class="tsd-comment tsd-typography"><p>information to use for dialing</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">protocols</span>: <a href="../enums/_waku_react.Protocols.html" class="tsd-signature-type tsd-kind-enum">Protocols</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>array of Waku protocols to be used for dialing. If no provided - will be derived from mounted protocols.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Stream</span><span class="tsd-signature-symbol">></span></h4><p><code>Promise</code> that will resolve to a <code>Stream</code> to a dialed peer and will reject if the connection fails</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-6">Example<a href="#example-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-8">await</span><span class="hl-1"> </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">dial</span><span class="hl-1">(</span><span class="hl-5">remotePeerId</span><span class="hl-1">, [</span><span class="hl-5">Protocols</span><span class="hl-1">.</span><span class="hl-5">LightPush</span><span class="hl-1">]);</span><br/><br/><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-4">true</span><span class="hl-1">;</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#dial">dial</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:27</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="getconnectedpeers"><span>get<wbr/>Connected<wbr/>Peers</span><a href="#getconnectedpeers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="getconnectedpeers-1"><span class="tsd-kind-call-signature">getConnectedPeers</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Peer</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#getconnectedpeers-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Peer</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>an array of all connected peers</p>
|
||
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#getconnectedpeers">getConnectedPeers</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:31</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="hangup"><span>hang<wbr/>Up</span><a href="#hangup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="hangup-1"><span class="tsd-kind-call-signature">hangUp</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">peer</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">MultiaddrInput</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#hangup-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Hang up a connection to a peer</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">peer</span>: <span class="tsd-signature-type">PeerId</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">MultiaddrInput</span></span><div class="tsd-comment tsd-typography"><p>information to use for hanging up</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p><code>Promise</code> that will resolve to <code>true</code> if the connection is hung up, <code>false</code> otherwise</p>
|
||
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#hangup">hangUp</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:28</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="isconnected"><span>is<wbr/>Connected</span><a href="#isconnected" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isconnected-1"><span class="tsd-kind-call-signature">isConnected</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#isconnected-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p><code>true</code> if the node has working connection and <code>false</code> otherwise</p>
|
||
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#isconnected">isConnected</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:34</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="isstarted"><span>is<wbr/>Started</span><a href="#isstarted" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="isstarted-1"><span class="tsd-kind-call-signature">isStarted</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><a href="#isstarted-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p><code>true</code> if the node was started and <code>false</code> otherwise</p>
|
||
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#isstarted">isStarted</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:33</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="start"><span>start</span><a href="#start" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="start-1"><span class="tsd-kind-call-signature">start</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#start-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Starts all services and components related to functionality of Waku node.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p><code>Promise</code> that will resolve when started.</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-7">Example<a href="#example-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-8">await</span><span class="hl-1"> </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">start</span><span class="hl-1">();</span><br/><br/><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">isStarted</span><span class="hl-1">() === </span><span class="hl-4">true</span><span class="hl-1">;</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#start">start</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:29</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="stop"><span>stop</span><a href="#stop" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="stop-1"><span class="tsd-kind-call-signature">stop</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#stop-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Stops all recurring processes and services that are needed for functionality of Waku node.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p><code>Promise</code> that resolves when stopped.</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-8">Example<a href="#example-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-8">await</span><span class="hl-1"> </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">stop</span><span class="hl-1">();</span><br/><br/><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-5">isStarted</span><span class="hl-1"> === </span><span class="hl-4">false</span><span class="hl-1">;</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#stop">stop</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:30</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><h3 class="tsd-anchor-link" id="waitforpeers"><span>wait<wbr/>For<wbr/>Peers</span><a href="#waitforpeers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="waitforpeers-1"><span class="tsd-kind-call-signature">waitForPeers</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">protocols</span><span class="tsd-signature-symbol">?:</span> <a href="../enums/_waku_react.Protocols.html" class="tsd-signature-type tsd-kind-enum">Protocols</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">timeoutMs</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforpeers-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Resolves when Waku successfully gains connection to a remote peers that fits provided requirements.
|
||
Must be used after attempting to connect to nodes, using <a href="../interfaces/_waku_react.IWaku.html#dial" class="tsd-kind-method">IWaku.dial</a> or
|
||
if was bootstrapped by using <a href="../interfaces/_waku_react.IPeerExchange.html" class="tsd-kind-interface">IPeerExchange</a> or <a href="../interfaces/_waku_react.DnsDiscoveryComponents.html" class="tsd-kind-interface">DnsDiscoveryComponents</a>.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">protocols</span>: <a href="../enums/_waku_react.Protocols.html" class="tsd-signature-type tsd-kind-enum">Protocols</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Protocols that need to be enabled by remote peers</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">timeoutMs</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Timeout value in milliseconds after which promise rejects</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p><code>Promise</code> that <strong>resolves</strong> if all desired protocols are fulfilled by
|
||
at least one remote peer, <strong>rejects</strong> if the timeoutMs is reached</p>
|
||
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link" id="throws-2">Throws<a href="#throws-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>If passing a protocol that is not mounted or Waku node is not started</p>
|
||
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example-9">Example<a href="#example-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-8">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">// let's wait for at least one LightPush node and timeout in 1 second</span><br/><span class="hl-1"> </span><span class="hl-8">await</span><span class="hl-1"> </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">waitForPeers</span><span class="hl-1">([</span><span class="hl-5">Protocols</span><span class="hl-1">.</span><span class="hl-5">LightPush</span><span class="hl-1">], </span><span class="hl-9">1000</span><span class="hl-1">);</span><br/><span class="hl-1">} </span><span class="hl-8">catch</span><span class="hl-1">(</span><span class="hl-5">e</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-4">false</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">"Failed to connect due to"</span><span class="hl-1">, </span><span class="hl-5">e</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-5">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-4">true</span><span class="hl-1">;</span>
|
||
</code><button type="button">Copy</button></pre>
|
||
|
||
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/_waku_react.IWaku.html">IWaku</a>.<a href="../interfaces/_waku_react.IWaku.html#waitforpeers">waitForPeers</a></p><ul><li>Defined in packages/sdk/dist/waku/waku.d.ts:32</li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#events"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>events</span></a><a href="#filter"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>filter</span></a><a href="#libp2p"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>libp2p</span></a><a href="#lightpush"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>light<wbr/>Push</span></a><a href="#relay"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>relay</span></a><a href="#store"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>store</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Accessors</summary><div><a href="#health"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>health</span></a><a href="#peerid"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>peer<wbr/>Id</span></a><a href="#protocols"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Accessor"><use href="../assets/icons.svg#icon-262144"></use></svg><span>protocols</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#createdecoder"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Decoder</span></a><a href="#createencoder"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Encoder</span></a><a href="#dial"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dial</span></a><a href="#getconnectedpeers"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Connected<wbr/>Peers</span></a><a href="#hangup"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>hang<wbr/>Up</span></a><a href="#isconnected"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Connected</span></a><a href="#isstarted"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Started</span></a><a href="#start"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</span></a><a href="#stop"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stop</span></a><a href="#waitforpeers"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Peers</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Documentation</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|