mirror of https://github.com/waku-org/js-waku.git
48 lines
40 KiB
HTML
48 lines
40 KiB
HTML
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>IWaku | 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></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Documentation</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">Documentation</a></li><li><a href="../modules/_waku_interfaces.html">@waku/interfaces</a></li><li><a href="_waku_interfaces.IWaku.html">IWaku</a></li></ul><h1>Interface IWaku</h1></div><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">IWaku</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#connectionManager">connectionManager</a><span class="tsd-signature-symbol">: </span><a href="_waku_interfaces.IConnectionManager.html" class="tsd-signature-type tsd-kind-interface">IConnectionManager</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#filter">filter</a><span class="tsd-signature-symbol">?: </span><a href="../types/_waku_interfaces.IFilter.html" class="tsd-signature-type tsd-kind-type-alias">IFilter</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#health">health</a><span class="tsd-signature-symbol">: </span><a href="_waku_interfaces.IHealthManager.html" class="tsd-signature-type tsd-kind-interface">IHealthManager</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#libp2p">libp2p</a><span class="tsd-signature-symbol">: </span><a href="../types/_waku_interfaces.Libp2p.html" class="tsd-signature-type tsd-kind-type-alias">Libp2p</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#lightPush">lightPush</a><span class="tsd-signature-symbol">?: </span><a href="../types/_waku_interfaces.ILightPush.html" class="tsd-signature-type tsd-kind-type-alias">ILightPush</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#peerId">peerId</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PeerId</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#protocols">protocols</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#relay">relay</a><span class="tsd-signature-symbol">?: </span><a href="../types/_waku_interfaces.IRelay.html" class="tsd-signature-type tsd-kind-type-alias">IRelay</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="_waku_interfaces.IWaku.html#store">store</a><span class="tsd-signature-symbol">?: </span><a href="../types/_waku_interfaces.IStore.html" class="tsd-signature-type tsd-kind-type-alias">IStore</a><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#dial.dial-1">dial</a><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">peer</span>, <span class="tsd-kind-parameter">protocols</span><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><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#isConnected.isConnected-1">isConnected</a><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#isStarted.isStarted-1">isStarted</a><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#start.start-1">start</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">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#stop.stop-1">stop</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">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-call-signature" href="_waku_interfaces.IWaku.html#waitForPeers.waitForPeers-1">waitForPeers</a><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">protocols</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">timeoutMs</span><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">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><section class="tsd-panel tsd-hierarchy"><h4>Hierarchy (<a class="link" href="../hierarchy.html#@waku/interfaces.IWaku">view full</a>)</h4><ul class="tsd-hierarchy"><li><span class="target">IWaku</span><ul class="tsd-hierarchy"><li><a href="_waku_interfaces.LightNode.html" class="tsd-signature-type tsd-kind-interface">LightNode</a></li><li><a href="_waku_interfaces.RelayNode.html" class="tsd-signature-type tsd-kind-interface">RelayNode</a></li></ul></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L13">packages/interfaces/src/waku.ts:13</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="_waku_interfaces.IWaku.html#connectionManager" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>connection<wbr/>Manager</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#filter" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>filter?</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#health" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>health</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#libp2p" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>libp2p</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#lightPush" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>light<wbr/>Push?</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#peerId" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>peer<wbr/>Id</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#protocols" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>protocols</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#relay" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>relay?</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#store" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><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">Methods</h3><div class="tsd-index-list"><a href="_waku_interfaces.IWaku.html#dial" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dial</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#isConnected" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Connected</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#isStarted" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Started</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#start" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#stop" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stop</span></a>
|
||
<a href="_waku_interfaces.IWaku.html#waitForPeers" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Peers</span></a>
|
||
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="connectionManager" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>connection<wbr/>Manager</span><a href="#connectionManager" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">connection<wbr/>Manager</span><span class="tsd-signature-symbol">:</span> <a href="_waku_interfaces.IConnectionManager.html" class="tsd-signature-type tsd-kind-interface">IConnectionManager</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L21">packages/interfaces/src/waku.ts:21</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="filter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>filter</span><a href="#filter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><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_interfaces.IFilter.html" class="tsd-signature-type tsd-kind-type-alias">IFilter</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L17">packages/interfaces/src/waku.ts:17</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="health" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>health</span><a href="#health" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">health</span><span class="tsd-signature-symbol">:</span> <a href="_waku_interfaces.IHealthManager.html" class="tsd-signature-type tsd-kind-interface">IHealthManager</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L20">packages/interfaces/src/waku.ts:20</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="libp2p" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>libp2p</span><a href="#libp2p" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><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_interfaces.Libp2p.html" class="tsd-signature-type tsd-kind-type-alias">Libp2p</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L14">packages/interfaces/src/waku.ts:14</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="lightPush" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>light<wbr/>Push</span><a href="#lightPush" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">light<wbr/>Push</span><span class="tsd-signature-symbol">?:</span> <a href="../types/_waku_interfaces.ILightPush.html" class="tsd-signature-type tsd-kind-type-alias">ILightPush</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L18">packages/interfaces/src/waku.ts:18</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="peerId" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>peer<wbr/>Id</span><a href="#peerId" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">peer<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">PeerId</span></div><div class="tsd-comment tsd-typography"><p>Returns a unique identifier for a node on the network.</p>
|
||
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="language-typescript"><span class="hl-3">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-3">peerId</span><span class="hl-1">); </span><span class="hl-4">// 12D3KooWNmk9yXHfHJ4rUduRqD1TCTHkNFMPF9WP2dqWpZDL4aUb</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L31">packages/interfaces/src/waku.ts:31</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="protocols" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>protocols</span><a href="#protocols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">protocols</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Returns a list of supported protocols.</p>
|
||
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="language-typescript"><span class="hl-3">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-3">protocols</span><span class="hl-1">); </span><span class="hl-4">// ['/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>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L41">packages/interfaces/src/waku.ts:41</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="relay" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>relay</span><a href="#relay" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><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_interfaces.IRelay.html" class="tsd-signature-type tsd-kind-type-alias">IRelay</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L15">packages/interfaces/src/waku.ts:15</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="store" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>store</span><a href="#store" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><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_interfaces.IStore.html" class="tsd-signature-type tsd-kind-type-alias">IStore</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L16">packages/interfaces/src/waku.ts:16</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods</h2><section class="tsd-panel tsd-member"><a id="dial" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dial</span><a href="#dial" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dial.dial-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dial</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">peer</span>, <span class="tsd-kind-parameter">protocols</span><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.dial-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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 ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">protocols</span>: <a href="../enums/_waku_interfaces.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</p>
|
||
<div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="language-typescript"><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">dial</span><span class="hl-1">(</span><span class="hl-3">remotePeerId</span><span class="hl-1">, [</span><span class="hl-3">Protocols</span><span class="hl-1">.</span><span class="hl-3">LightPush</span><span class="hl-1">]);</span><br/><br/><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-6">true</span><span class="hl-1">;</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L58">packages/interfaces/src/waku.ts:58</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="isConnected" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Connected</span><a href="#isConnected" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="isConnected.isConnected-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Connected</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#isConnected.isConnected-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L123">packages/interfaces/src/waku.ts:123</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="isStarted" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Started</span><a href="#isStarted" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="isStarted.isStarted-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Started</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#isStarted.isStarted-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L118">packages/interfaces/src/waku.ts:118</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="start" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>start</span><a href="#start" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="start.start-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">start</span><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">void</span><span class="tsd-signature-symbol">></span><a href="#start.start-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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"><h4>Example</h4><pre><code class="language-typescript"><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">start</span><span class="hl-1">();</span><br/><br/><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">isStarted</span><span class="hl-1">() === </span><span class="hl-6">true</span><span class="hl-1">;</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L72">packages/interfaces/src/waku.ts:72</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="stop" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>stop</span><a href="#stop" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="stop.stop-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">stop</span><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">void</span><span class="tsd-signature-symbol">></span><a href="#stop.stop-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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"><h4>Example</h4><pre><code class="language-typescript"><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">stop</span><span class="hl-1">();</span><br/><br/><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-3">isStarted</span><span class="hl-1"> === </span><span class="hl-6">false</span><span class="hl-1">;</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L86">packages/interfaces/src/waku.ts:86</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="waitForPeers" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Peers</span><a href="#waitForPeers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="waitForPeers.waitForPeers-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">wait<wbr/>For<wbr/>Peers</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">protocols</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">timeoutMs</span><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">void</span><span class="tsd-signature-symbol">></span><a href="#waitForPeers.waitForPeers-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li 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="_waku_interfaces.IWaku.html#dial" class="tsd-kind-method">IWaku.dial</a> or
|
||
if was bootstrapped by using <a href="_waku_interfaces.IPeerExchange.html" class="tsd-kind-interface">IPeerExchange</a> or <a href="_waku_interfaces.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 ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">protocols</span>: <a href="../enums/_waku_interfaces.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 ts-flagOptional">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"><h4>Throws</h4><p>If passing a protocol that is not mounted or Waku node is not started</p>
|
||
<h4>Example</h4><pre><code class="language-typescript"><span class="hl-5">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">// let's wait for at least one LightPush node and timeout in 1 second</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">waitForPeers</span><span class="hl-1">([</span><span class="hl-3">Protocols</span><span class="hl-1">.</span><span class="hl-3">LightPush</span><span class="hl-1">], </span><span class="hl-7">1000</span><span class="hl-1">);</span><br/><span class="hl-1">} </span><span class="hl-5">catch</span><span class="hl-1">(</span><span class="hl-3">e</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-6">false</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">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-3">e</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-3">waku</span><span class="hl-1">.</span><span class="hl-0">isConnected</span><span class="hl-1">() === </span><span class="hl-6">true</span><span class="hl-1">;</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/waku-org/js-waku/blob/88e33a90fd2a4de93d4ce0cb99dbd77ff454ef34/packages/interfaces/src/waku.ts#L113">packages/interfaces/src/waku.ts:113</a></li></ul></aside></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><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-private" name="private"/><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>Private</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></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><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-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#connectionManager" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>connection<wbr/>Manager</span></a><a href="#filter" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>filter</span></a><a href="#health" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>health</span></a><a href="#libp2p" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>libp2p</span></a><a href="#lightPush" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>light<wbr/>Push</span></a><a href="#peerId" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>peer<wbr/>Id</span></a><a href="#protocols" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>protocols</span></a><a href="#relay" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>relay</span></a><a href="#store" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>store</span></a><a href="#dial" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dial</span></a><a href="#isConnected" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Connected</span></a><a href="#isStarted" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Started</span></a><a href="#start" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start</span></a><a href="#stop" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stop</span></a><a href="#waitForPeers" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Peers</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>Documentation</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><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> |