</div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#peerId">peerId</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/7c0ce7b2eca31cab837da0251e1e4255151be2f7/packages/interfaces/src/waku.ts#L31">packages/interfaces/src/waku.ts:31</a></li></ul></aside></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="protocols"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>protocols</span><ahref="#protocols"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><divclass="tsd-signature"><spanclass="tsd-kind-property">protocols</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">string</span><spanclass="tsd-signature-symbol">[]</span></div><divclass="tsd-comment tsd-typography"><p>Returns a list of supported protocols.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">peer</span>: <spanclass="tsd-signature-type">PeerId</span><spanclass="tsd-signature-symbol"> | </span><spanclass="tsd-signature-type">MultiaddrInput</span></span><divclass="tsd-comment tsd-typography"><p>information to use for dialing</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">protocols</span>: <ahref="../enums/_waku_interfaces.Protocols.html"class="tsd-signature-type tsd-kind-enum">Protocols</a><spanclass="tsd-signature-symbol">[]</span></span><divclass="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><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">Stream</span><spanclass="tsd-signature-symbol">></span></h4><p><code>Promise</code> that will resolve to a <code>Stream</code> to a dialed peer</p>
</div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#dial">dial</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/7c0ce7b2eca31cab837da0251e1e4255151be2f7/packages/interfaces/src/waku.ts#L58">packages/interfaces/src/waku.ts:58</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="isConnected"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>is<wbr/>Connected</span><ahref="#isConnected"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited"><liclass="tsd-signature tsd-anchor-link"><aid="isConnected.isConnected-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">is<wbr/>Connected</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">boolean</span><ahref="#isConnected.isConnected-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">boolean</span></h4><p><code>true</code> if the node has working connection and <code>false</code> otherwise</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#isConnected">isConnected</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/7c0ce7b2eca31cab837da0251e1e4255151be2f7/packages/interfaces/src/waku.ts#L123">packages/interfaces/src/waku.ts:123</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="isStarted"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>is<wbr/>Started</span><ahref="#isStarted"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited"><liclass="tsd-signature tsd-anchor-link"><aid="isStarted.isStarted-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">is<wbr/>Started</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type">boolean</span><ahref="#isStarted.isStarted-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type">boolean</span></h4><p><code>true</code> if the node was started and <code>false</code> otherwise</p>
<divclass="tsd-comment tsd-typography"></div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#isStarted">isStarted</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/7c0ce7b2eca31cab837da0251e1e4255151be2f7/packages/interfaces/src/waku.ts#L118">packages/interfaces/src/waku.ts:118</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="start"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>start</span><ahref="#start"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited"><liclass="tsd-signature tsd-anchor-link"><aid="start.start-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">start</span><spanclass="tsd-signature-symbol">(</span><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">void</span><spanclass="tsd-signature-symbol">></span><ahref="#start.start-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Starts all services and components related to functionality of Waku node.</p>
</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><p><code>Promise</code> that will resolve when started.</p>
</div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#start">start</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/7c0ce7b2eca31cab837da0251e1e4255151be2f7/packages/interfaces/src/waku.ts#L72">packages/interfaces/src/waku.ts:72</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="stop"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>stop</span><ahref="#stop"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ulclass="tsd-signatures tsd-is-inherited"><liclass="tsd-signature tsd-anchor-link"><aid="stop.stop-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">stop</span><spanclass="tsd-signature-symbol">(</span><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">void</span><spanclass="tsd-signature-symbol">></span><ahref="#stop.stop-1"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="../assets/icons.svg#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Stops all recurring processes and services that are needed for functionality of Waku node.</p>
</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><p><code>Promise</code> that resolves when stopped.</p>
Must be used after attempting to connect to nodes, using <ahref="_waku_interfaces.IWaku.html#dial"class="tsd-kind-method">IWaku.dial</a> or
if was bootstrapped by using <ahref="_waku_interfaces.IPeerExchange.html"class="tsd-kind-interface">IPeerExchange</a> or <ahref="_waku_interfaces.DnsDiscoveryComponents.html"class="tsd-kind-interface">DnsDiscoveryComponents</a>.</p>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">protocols</span>: <ahref="../enums/_waku_interfaces.Protocols.html"class="tsd-signature-type tsd-kind-enum">Protocols</a><spanclass="tsd-signature-symbol">[]</span></span><divclass="tsd-comment tsd-typography"><p>Protocols that need to be enabled by remote peers</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><span><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">timeoutMs</span>: <spanclass="tsd-signature-type">number</span></span><divclass="tsd-comment tsd-typography"><p>Timeout value in milliseconds after which promise rejects</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><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>
<divclass="tsd-comment tsd-typography"><h4>Throws</h4><p>If passing a protocol that is not mounted or Waku node is not started</p>
<h4>Example</h4><pre><codeclass="language-typescript"><spanclass="hl-5">try</span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-4">// let's wait for at least one LightPush node and timeout in 1 second</span><br/><spanclass="hl-1"></span><spanclass="hl-5">await</span><spanclass="hl-1"></span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">waitForPeers</span><spanclass="hl-1">([</span><spanclass="hl-3">Protocols</span><spanclass="hl-1">.</span><spanclass="hl-3">LightPush</span><spanclass="hl-1">], </span><spanclass="hl-7">1000</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">} </span><spanclass="hl-5">catch</span><spanclass="hl-1">(</span><spanclass="hl-3">e</span><spanclass="hl-1">) {</span><br/><spanclass="hl-1"></span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">isConnected</span><spanclass="hl-1">() === </span><spanclass="hl-6">false</span><spanclass="hl-1">;</span><br/><spanclass="hl-1"></span><spanclass="hl-3">console</span><spanclass="hl-1">.</span><spanclass="hl-0">error</span><spanclass="hl-1">(</span><spanclass="hl-2">"Failed to connect due to"</span><spanclass="hl-1">, </span><spanclass="hl-3">e</span><spanclass="hl-1">);</span><br/><spanclass="hl-1">}</span><br/><br/><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">isConnected</span><spanclass="hl-1">() === </span><spanclass="hl-6">true</span><spanclass="hl-1">;</span>