[CI Skip] 0.30.26
This commit is contained in:
@@ -369,10 +369,16 @@
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<p>The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won´t be able to listen to events such as new blocks or balance changes. It is usually preferrable using the <a href="_ws_index_.wsprovider.html">WsProvider</a>.
|
||||
<em><strong>example</strong></em>: import createApi from '@polkadot/api'; import WsProvider from '@polkadot/api-provider/ws';</p>
|
||||
<p>const provider = new WsProvider('<a href="http://127.0.0.1:9933'" target="_blank">http://127.0.0.1:9933')</a>); const api = createApi(provider);</p>
|
||||
<p><em><strong>see</strong></em>: <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
|
||||
<p><em><strong>name</strong></em>: HttpProvider</p>
|
||||
<p><em><strong>summary</strong></em>: The HTTP Provider allows sending requests using HTTP.</p>
|
||||
<p><em><strong>description</strong></em>: It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferrable using the <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><em><strong>example</strong></em>: </p>
|
||||
<pre><code>import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
</code></pre><p><em><strong>see</strong></em>: <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
<p><strong>HttpProvider</strong></p>
|
||||
<h1 id="implements">Implements</h1>
|
||||
@@ -383,19 +389,21 @@
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new HttpProvider</strong>(endpoint: <em><code>string</code></em>): <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L35" target="_blank">http/index.ts:35</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L38" target="_blank">http/index.ts:38</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>endpoint</td>
|
||||
<td><code>string</code></td>
|
||||
<td>The endpoint url starting with http://</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -406,8 +414,8 @@
|
||||
<h2 id="isconnected">isConnected</h2>
|
||||
<p>▸ <strong>isConnected</strong>(): <code>boolean</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#isconnected">isConnected</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L49" target="_blank">http/index.ts:49</a></em></p>
|
||||
<p>Whether the node is connected or not.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L55" target="_blank">http/index.ts:55</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Whether the node is connected or not.</p>
|
||||
<p><strong>Returns:</strong> <code>boolean</code>
|
||||
true if connected</p>
|
||||
<hr>
|
||||
@@ -415,8 +423,9 @@ true if connected</p>
|
||||
<h2 id="on">on</h2>
|
||||
<p>▸ <strong>on</strong>(type: <em><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>void</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#on">on</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L56" target="_blank">http/index.ts:56</a></em></p>
|
||||
<p>Events are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L63" target="_blank">http/index.ts:63</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Events are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><em><strong>description</strong></em>: HTTP Provider does not have 'on' emitters. WebSockets should be used instead.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -442,7 +451,8 @@ true if connected</p>
|
||||
<h2 id="send">send</h2>
|
||||
<p>▸ <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#send">send</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L60" target="_blank">http/index.ts:60</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L70" target="_blank">http/index.ts:70</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Send HTTP POST Request with Body to configured HTTP Endpoint.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -468,8 +478,8 @@ true if connected</p>
|
||||
<h2 id="subscribe">subscribe</h2>
|
||||
<p>▸ <strong>subscribe</strong>(types: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>, cb: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#subscribe">subscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L82" target="_blank">http/index.ts:82</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L92" target="_blank">http/index.ts:92</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -503,8 +513,8 @@ true if connected</p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#unsubscribe">unsubscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L91" target="_blank">http/index.ts:91</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L101" target="_blank">http/index.ts:101</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -573,7 +583,7 @@ true if connected</p>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"HttpProvider","level":"1.3.1","depth":2,"next":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]},"previous":{"title":"api-provider","level":"1.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_http_index_.httpprovider.md","mtime":"2018-10-04T20:14:09.170Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-04T20:14:53.260Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"HttpProvider","level":"1.3.1","depth":2,"next":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]},"previous":{"title":"api-provider","level":"1.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_http_index_.httpprovider.md","mtime":"2018-10-05T06:45:35.885Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-05T06:46:24.745Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
|
||||
|
||||
The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won´t be able to listen to events such as new blocks or balance changes. It is usually preferrable using the [WsProvider](_ws_index_.wsprovider.md).
|
||||
*__example__*: import createApi from '@polkadot/api'; import WsProvider from '@polkadot/api-provider/ws';
|
||||
*__name__*: HttpProvider
|
||||
|
||||
const provider = new WsProvider('[http://127.0.0.1:9933')](http://127.0.0.1:9933')); const api = createApi(provider);
|
||||
*__summary__*: The HTTP Provider allows sending requests using HTTP.
|
||||
|
||||
*__description__*: It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferrable using the [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
*__example__*:
|
||||
|
||||
```
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
@@ -23,13 +34,13 @@ const provider = new WsProvider('[http://127.0.0.1:9933')](http://127.0.0.1:9933
|
||||
|
||||
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L35)*
|
||||
*Defined in [http/index.ts:38](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L38)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| endpoint | `string` |
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| endpoint | `string` | The endpoint url starting with http:// |
|
||||
|
||||
**Returns:** [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
@@ -45,9 +56,9 @@ ___
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[isConnected](../interfaces/_types_d_.providerinterface.md#isconnected)*
|
||||
|
||||
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L49)*
|
||||
*Defined in [http/index.ts:55](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L55)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
*__summary__*: Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
@@ -61,9 +72,11 @@ ___
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[on](../interfaces/_types_d_.providerinterface.md#on)*
|
||||
|
||||
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L56)*
|
||||
*Defined in [http/index.ts:63](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L63)*
|
||||
|
||||
Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
*__summary__*: Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
*__description__*: HTTP Provider does not have 'on' emitters. WebSockets should be used instead.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -83,7 +96,9 @@ ___
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[send](../interfaces/_types_d_.providerinterface.md#send)*
|
||||
|
||||
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L60)*
|
||||
*Defined in [http/index.ts:70](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L70)*
|
||||
|
||||
*__summary__*: Send HTTP POST Request with Body to configured HTTP Endpoint.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -103,9 +118,9 @@ ___
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[subscribe](../interfaces/_types_d_.providerinterface.md#subscribe)*
|
||||
|
||||
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L82)*
|
||||
*Defined in [http/index.ts:92](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L92)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
*__summary__*: Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -127,9 +142,9 @@ ___
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[unsubscribe](../interfaces/_types_d_.providerinterface.md#unsubscribe)*
|
||||
|
||||
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/http/index.ts#L91)*
|
||||
*Defined in [http/index.ts:101](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/http/index.ts#L101)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
*__summary__*: Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
|
||||
@@ -369,9 +369,16 @@
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<p>The WebSocket Provider allows sending requests using WebSocket. Unlike the <a href="_http_index_.httpprovider.html">HttpProvider</a>, it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
<em><strong>example</strong></em>: import createApi from '@polkadot/api'; import WsProvider from '@polkadot/api-provider/ws'; const provider = new WsProvider('ws://127.0.0.1:9944'); const api = createApi(provider);</p>
|
||||
<p><em><strong>see</strong></em>: <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<p><em><strong>name</strong></em>: WsProvider</p>
|
||||
<p><em><strong>summary</strong></em>: The WebSocket Provider allows sending requests using WebSocket.</p>
|
||||
<p><em><strong>description</strong></em>: Unlike the <a href="_http_index_.httpprovider.html">HttpProvider</a>, it does support subscriptions and allows listening to events such as new blocks or balance changes.</p>
|
||||
<p><em><strong>example</strong></em>: </p>
|
||||
<pre><code>import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
</code></pre><p><em><strong>see</strong></em>: <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<h1 id="type-parameters">Type parameters</h1>
|
||||
<h4 id="eventtypes----string--symbol">EventTypes : <code>string</code> | <code>symbol</code></h4>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
@@ -385,7 +392,7 @@
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new WsProvider</strong>(endpoint: <em><code>string</code></em>, autoConnect?: <em><code>boolean</code></em>): <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L67" target="_blank">ws/index.ts:67</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L71" target="_blank">ws/index.ts:71</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -455,8 +462,9 @@
|
||||
<p><a id="connect"></a></p>
|
||||
<h2 id="connect">connect</h2>
|
||||
<p>▸ <strong>connect</strong>(): <code>void</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L97" target="_blank">ws/index.ts:97</a></em></p>
|
||||
<p>The <a href="_ws_index_.wsprovider.html">WsProvider</a> connects automatically by default. if you decided otherwise, you may connect manually using this method.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L102" target="_blank">ws/index.ts:102</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Manually connect</p>
|
||||
<p><em><strong>description</strong></em>: The <a href="_ws_index_.wsprovider.html">WsProvider</a> connects automatically by default, however if you decided otherwise, you may connect manually using this method.</p>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="emit"></a></p>
|
||||
@@ -497,8 +505,8 @@
|
||||
<p><a id="isconnected"></a></p>
|
||||
<h2 id="isconnected">isConnected</h2>
|
||||
<p>▸ <strong>isConnected</strong>(): <code>boolean</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L114" target="_blank">ws/index.ts:114</a></em></p>
|
||||
<p>Whether the node is connected or not.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L119" target="_blank">ws/index.ts:119</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Whether the node is connected or not.</p>
|
||||
<p><strong>Returns:</strong> <code>boolean</code>
|
||||
true if connected</p>
|
||||
<hr>
|
||||
@@ -586,8 +594,8 @@ true if connected</p>
|
||||
<h2 id="on">on</h2>
|
||||
<p>▸ <strong>on</strong>(type: <em><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>this</code></p>
|
||||
<p><em>Overrides EventEmitter.on</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L124" target="_blank">ws/index.ts:124</a></em></p>
|
||||
<p>Listens on events after having subscribed using the <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a> function.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L129" target="_blank">ws/index.ts:129</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Listens on events after having subscribed using the <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a> function.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -705,7 +713,8 @@ true if connected</p>
|
||||
<p><a id="send"></a></p>
|
||||
<h2 id="send">send</h2>
|
||||
<p>▸ <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>, subscription?: <em><code>SubscriptionHandler</code></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L128" target="_blank">ws/index.ts:128</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L136" target="_blank">ws/index.ts:136</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Send JSON data using WebSockets to configured HTTP Endpoint or queue.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -734,12 +743,15 @@ true if connected</p>
|
||||
<p><a id="subscribe"></a></p>
|
||||
<h2 id="subscribe">subscribe</h2>
|
||||
<p>▸ <strong>subscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>, callback: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L179" target="_blank">ws/index.ts:179</a></em></p>
|
||||
<p>Allows subscribing to a specific event.
|
||||
<em><strong>example</strong></em>: const provider = new WsProvider('ws://127.0.0.1:9944'); const api = createApi(provider);</p>
|
||||
<p>api.state.storage([[storage.balances.freeBalance,</p>
|
||||
<p>]], (_, values) => { console.log(values) }).then((subscriptionId) => { console.log('balance changes subscription id: ', subscriptionId) })</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L190" target="_blank">ws/index.ts:190</a></em></p>
|
||||
<p><em><strong>name</strong></em>: subscribe</p>
|
||||
<p><em><strong>summary</strong></em>: Allows subscribing to a specific event.</p>
|
||||
<p><em><strong>example</strong></em>: </p>
|
||||
<pre><code>const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
|
||||
api.state.storage([[storage.balances.freeBalance,
|
||||
</code></pre><p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -777,8 +789,8 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L188" target="_blank">ws/index.ts:188</a></em></p>
|
||||
<p>Allows unsubscribing to subscriptions made with <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a>.</p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L199" target="_blank">ws/index.ts:199</a></em></p>
|
||||
<p><em><strong>summary</strong></em>: Allows unsubscribing to subscriptions made with <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -847,7 +859,7 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"WsProvider","level":"1.3.2","depth":2,"next":{"title":"api-rx","level":"1.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]}]},"previous":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_ws_index_.wsprovider.md","mtime":"2018-10-04T20:14:09.246Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-04T20:14:53.260Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"WsProvider","level":"1.3.2","depth":2,"next":{"title":"api-rx","level":"1.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]}]},"previous":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_ws_index_.wsprovider.md","mtime":"2018-10-05T06:45:35.985Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-05T06:46:24.745Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
|
||||
|
||||
The WebSocket Provider allows sending requests using WebSocket. Unlike the [HttpProvider](_http_index_.httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
*__example__*: import createApi from '@polkadot/api'; import WsProvider from '@polkadot/api-provider/ws'; const provider = new WsProvider('ws://127.0.0.1:9944'); const api = createApi(provider);
|
||||
*__name__*: WsProvider
|
||||
|
||||
*__summary__*: The WebSocket Provider allows sending requests using WebSocket.
|
||||
|
||||
*__description__*: Unlike the [HttpProvider](_http_index_.httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
@@ -26,7 +39,7 @@ The WebSocket Provider allows sending requests using WebSocket. Unlike the [Http
|
||||
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
*Defined in [ws/index.ts:67](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L67)*
|
||||
*Defined in [ws/index.ts:71](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L71)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -83,9 +96,11 @@ ___
|
||||
|
||||
▸ **connect**(): `void`
|
||||
|
||||
*Defined in [ws/index.ts:97](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L97)*
|
||||
*Defined in [ws/index.ts:102](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L102)*
|
||||
|
||||
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
*__summary__*: Manually connect
|
||||
|
||||
*__description__*: The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default, however if you decided otherwise, you may connect manually using this method.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
@@ -133,9 +148,9 @@ ___
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [ws/index.ts:114](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L114)*
|
||||
*Defined in [ws/index.ts:119](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L119)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
*__summary__*: Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
@@ -213,9 +228,9 @@ ___
|
||||
|
||||
*Overrides EventEmitter.on*
|
||||
|
||||
*Defined in [ws/index.ts:124](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L124)*
|
||||
*Defined in [ws/index.ts:129](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L129)*
|
||||
|
||||
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
*__summary__*: Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -302,7 +317,9 @@ ___
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
|
||||
|
||||
*Defined in [ws/index.ts:128](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L128)*
|
||||
*Defined in [ws/index.ts:136](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L136)*
|
||||
|
||||
*__summary__*: Send JSON data using WebSockets to configured HTTP Endpoint or queue.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -321,14 +338,20 @@ ___
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [ws/index.ts:179](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L179)*
|
||||
*Defined in [ws/index.ts:190](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L190)*
|
||||
|
||||
Allows subscribing to a specific event.
|
||||
*__example__*: const provider = new WsProvider('ws://127.0.0.1:9944'); const api = createApi(provider);
|
||||
*__name__*: subscribe
|
||||
|
||||
api.state.storage(\[\[storage.balances.freeBalance,
|
||||
*__summary__*: Allows subscribing to a specific event.
|
||||
|
||||
\]\], (_, values) => { console.log(values) }).then((subscriptionId) => { console.log('balance changes subscription id: ', subscriptionId) })
|
||||
*__example__*:
|
||||
|
||||
```
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
|
||||
api.state.storage([[storage.balances.freeBalance,
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -349,9 +372,9 @@ ___
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [ws/index.ts:188](https://github.com/polkadot-js/api/blob/522eae6/packages/api-provider/src/ws/index.ts#L188)*
|
||||
*Defined in [ws/index.ts:199](https://github.com/polkadot-js/api/blob/fd596a1/packages/api-provider/src/ws/index.ts#L199)*
|
||||
|
||||
Allows unsubscribing to subscriptions made with [subscribe](_ws_index_.wsprovider.md#subscribe).
|
||||
*__summary__*: Allows unsubscribing to subscriptions made with [subscribe](_ws_index_.wsprovider.md#subscribe).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user