</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/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L57">packages/interfaces/src/waku.ts:57</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><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#protocols">protocols</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L67">packages/interfaces/src/waku.ts:67</a></li></ul></aside></section><sectionclass="tsd-panel tsd-member"><aid="relay"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>relay</span><ahref="#relay"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">relay</span><spanclass="tsd-signature-symbol">:</span><ahref="../types/_waku_interfaces.IRelay.html"class="tsd-signature-type tsd-kind-type-alias">IRelay</a></div><asideclass="tsd-sources"><p>Overrides <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#relay">relay</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L225">packages/interfaces/src/waku.ts:225</a></li></ul></aside></section><sectionclass="tsd-panel tsd-member"><aid="store"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>store</span><ahref="#store"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">store</span><spanclass="tsd-signature-symbol">:</span><spanclass="tsd-signature-type">undefined</span></div><asideclass="tsd-sources"><p>Overrides <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#store">store</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L226">packages/interfaces/src/waku.ts:226</a></li></ul></aside></section></section><sectionclass="tsd-panel-group tsd-member-group"><h2>Methods</h2><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="createDecoder"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>create<wbr/>Decoder</span><ahref="#createDecoder"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="createDecoder.createDecoder-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">create<wbr/>Decoder</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">params</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="_waku_interfaces.IDecoder.html"class="tsd-signature-type tsd-kind-interface">IDecoder</a><spanclass="tsd-signature-symbol"><</span><ahref="_waku_interfaces.IDecodedMessage.html"class="tsd-signature-type tsd-kind-interface">IDecodedMessage</a><spanclass="tsd-signature-symbol">></span><ahref="#createDecoder.createDecoder-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>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><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">params</span>: <ahref="../types/_waku_interfaces.CreateDecoderParams.html"class="tsd-signature-type tsd-kind-type-alias">CreateDecoderParams</a></span><divclass="tsd-comment tsd-typography"><p>Configuration for the decoder</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="_waku_interfaces.IDecoder.html"class="tsd-signature-type tsd-kind-interface">IDecoder</a><spanclass="tsd-signature-symbol"><</span><ahref="_waku_interfaces.IDecodedMessage.html"class="tsd-signature-type tsd-kind-interface">IDecodedMessage</a><spanclass="tsd-signature-symbol">></span></h4><p>A decoder instance configured for the specified content topic</p>
<divclass="tsd-comment tsd-typography"><h4>Throws</h4><p>If the shard configuration is incompatible with the node's network settings</p>
<h4>Example</h4><pre><codeclass="language-typescript"><spanclass="hl-4">// Create a decoder with default network shard settings</span><br/><spanclass="hl-5">const</span><spanclass="hl-1"></span><spanclass="hl-6">decoder</span><spanclass="hl-1"> = </span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">createDecoder</span><spanclass="hl-1">({</span><br/><spanclass="hl-1"></span><spanclass="hl-3">contentTopic:</span><spanclass="hl-1"></span><spanclass="hl-2">"/my-app/1/chat/proto"</span><br/><spanclass="hl-1">});</span><br/><br/><spanclass="hl-4">// Create a decoder with custom shard settings</span><br/><spanclass="hl-5">const</span><spanclass="hl-1"></span><spanclass="hl-6">customDecoder</span><spanclass="hl-1"> = </span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">createDecoder</span><spanclass="hl-1">({</span><br/><spanclass="hl-1"></span><spanclass="hl-3">contentTopic:</span><spanclass="hl-1"></span><spanclass="hl-2">"/my-app/1/chat/proto"</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"></span><spanclass="hl-3">shardInfo:</span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-3">clusterId:</span><spanclass="hl-1"></span><spanclass="hl-7">1</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"></span><spanclass="hl-3">shard:</span><spanclass="hl-1"></span><spanclass="hl-7">5</span><br/><spanclass="hl-1"> }</span><br/><spanclass="hl-1">});</span>
</div><asideclass="tsd-sources"><p>Inherited from <ahref="_waku_interfaces.IWaku.html">IWaku</a>.<ahref="_waku_interfaces.IWaku.html#createDecoder">createDecoder</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L168">packages/interfaces/src/waku.ts:168</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="createEncoder"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>create<wbr/>Encoder</span><ahref="#createEncoder"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="createEncoder.createEncoder-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">create<wbr/>Encoder</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">params</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="_waku_interfaces.IEncoder.html"class="tsd-signature-type tsd-kind-interface">IEncoder</a><ahref="#createEncoder.createEncoder-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>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><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><span><spanclass="tsd-kind-parameter">params</span>: <ahref="../types/_waku_interfaces.CreateEncoderParams.html"class="tsd-signature-type tsd-kind-type-alias">CreateEncoderParams</a></span><divclass="tsd-comment tsd-typography"><p>Configuration for the encoder including content topic and optionally shard information and ephemeral flag</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="_waku_interfaces.IEncoder.html"class="tsd-signature-type tsd-kind-interface">IEncoder</a></h4><p>An encoder instance configured for the specified content topic</p>
<divclass="tsd-comment tsd-typography"><h4>Throws</h4><p>If the shard configuration is incompatible with the node's network settings</p>
<h4>Example</h4><pre><codeclass="language-typescript"><spanclass="hl-4">// Create a basic encoder with default network shard settings</span><br/><spanclass="hl-5">const</span><spanclass="hl-1"></span><spanclass="hl-6">encoder</span><spanclass="hl-1"> = </span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">createEncoder</span><spanclass="hl-1">({</span><br/><spanclass="hl-1"></span><spanclass="hl-3">contentTopic:</span><spanclass="hl-1"></span><spanclass="hl-2">"/my-app/1/chat/proto"</span><br/><spanclass="hl-1">});</span><br/><br/><spanclass="hl-4">// Create an ephemeral encoder (messages won't be stored by store nodes)</span><br/><spanclass="hl-5">const</span><spanclass="hl-1"></span><spanclass="hl-6">ephemeralEncoder</span><spanclass="hl-1"> = </span><spanclass="hl-3">waku</span><spanclass="hl-1">.</span><spanclass="hl-0">createEncoder</span><spanclass="hl-1">({</span><br/><spanclass="hl-1"></span><spanclass="hl-3">contentTopic:</span><spanclass="hl-1"></span><spanclass="hl-2">"/my-app/1/notifications/proto"</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"></span><spanclass="hl-3">ephemeral:</span><spanclass="hl-1"></span><spanclass="hl-5">true</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"></span><spanclass="hl-3">shardInfo:</span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-3">clusterId:</span><spanclass="hl-1"></span><spanclass="hl-7">2</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"></span><spanclass="hl-3">shardsUnderCluster:</span><spanclass="hl-1"></span><spanclass="hl-7">16</span><br/><spanclass="hl-1"> }</span><br/><spanclass="hl-1">});</span>
</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/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L84">packages/interfaces/src/waku.ts:84</a></li></ul></aside></li></ul></section><sectionclass="tsd-panel tsd-member tsd-is-inherited"><aid="getConnectedPeers"class="tsd-anchor"></a><h3class="tsd-anchor-link"><span>get<wbr/>Connected<wbr/>Peers</span><ahref="#getConnectedPeers"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="getConnectedPeers.getConnectedPeers-1"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">get<wbr/>Connected<wbr/>Peers</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">Peer</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">></span><ahref="#getConnectedPeers.getConnectedPeers-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">Promise</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type">Peer</span><spanclass="tsd-signature-symbol">[]</span><spanclass="tsd-signature-symbol">></span></h4><p>an array of all connected peers</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#getConnectedPeers">getConnectedPeers</a></p><ul><li>Defined in <ahref="https://github.com/waku-org/js-waku/blob/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L213">packages/interfaces/src/waku.ts:213</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/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L208">packages/interfaces/src/waku.ts:208</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/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L203">packages/interfaces/src/waku.ts:203</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/49f26d89a8032386ee5b3ba629713b4f84891d5d/packages/interfaces/src/waku.ts#L98">packages/interfaces/src/waku.ts:98</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-8">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-8">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-8">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-5">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-5">true</span><spanclass="hl-1">;</span>