Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Oct 5, 2018
1 parent ff8aeb0 commit a7fc567
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion book.json
Expand Up @@ -2,7 +2,8 @@
"title": "Polkadot API Book",
"gitbook": ">=2.4.0",
"plugins": [
"include-codeblock"
"include-codeblock",
"mermaid-gb3"
],
"root": "docs",
"pluginsConfig": {}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -25,6 +25,7 @@
"@polkadot/ts": "^0.1.30"
},
"dependencies": {
"gitbook-plugin-include-codeblock": "^3.2.2"
"gitbook-plugin-include-codeblock": "^3.2.2",
"gitbook-plugin-mermaid-gb3": "^2.1.0"
}
}
6 changes: 3 additions & 3 deletions packages/api-provider/src/http/index.ts
Expand Up @@ -17,16 +17,16 @@ const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSocke

/**
* @name HttpProvider
* @summary The HTTP Provider allows sending requests using HTTP.
* @summary The HTTP Provider allows sending requests using HTTP to HTTP RPC server TCP port
* @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]].
*
* @example
* <BR><PRE><CODE>
* import createApi from '@polkadot/api';
* import WsProvider from '@polkadot/api-provider/ws';
* import HttpProvider from '@polkadot/api-provider/http';
* <BR>
* const provider = new WsProvider('http://127.0.0.1:9933');
* const provider = new HttpProvider('http://127.0.0.1:9933');
* const api = createApi(provider);
* </CODE></PRE>
*
Expand Down
2 changes: 1 addition & 1 deletion packages/api-provider/src/ws/index.ts
Expand Up @@ -39,7 +39,7 @@ interface WSProviderInterface extends ProviderInterface {

/**
* @name WsProvider
* @summary The WebSocket Provider allows sending requests using WebSocket.
* @summary The WebSocket Provider allows sending requests using WebSocket to WebSocket RPC server TCP port.
* @description Unlike the [[HttpProvider]], it does support subscriptions and allows
* listening to events such as new blocks or balance changes.
* @example
Expand Down
11 changes: 10 additions & 1 deletion packages/api/src/index.ts
Expand Up @@ -17,12 +17,21 @@ import isFunction from '@polkadot/util/is/function';
* @name Api
* @summary The API may use a HTTP or WebSockets provider.
* @description It allows for querying a Polkadot Client Node.
*
* ```mermaid
* graph LR;
* A[Api] --> |protocol| B{Decision};
* B --> |Http| D[HttpProvider];
* B --> |WebSockets| E[WsProvider];
* D --> |endpoint| F[https://127.0.0.1:9933]
* E --> |endpoint| G[ws://127.0.0.1:9944]
* ```
* @example
* <BR><PRE><CODE>
* import Api from '@polkadot/api';
* import WsProvider from '@polkadot/api-provider/ws';
* <BR>
* const provider = new WsProvider('http://127.0.0.1:9944');
* const provider = new WsProvider('ws://127.0.0.1:9944');
* const api = new Api(provider);
* </CODE></PRE>
*/
Expand Down

0 comments on commit a7fc567

Please sign in to comment.