@graffy/client 0.15.18 → 0.15.19-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Readme.md +24 -4
  2. package/package.json +4 -4
package/Readme.md CHANGED
@@ -1,9 +1,29 @@
1
1
  # Graffy Client
2
2
 
3
- Graffy client library for the browser.
3
+ Graffy client library for the browser, usin the `fetch()` or `WebSocket` APIs. This module is intended to be used with a Node.js server running Graffy Server.
4
4
 
5
- It uses the `fetch()` and `EventStream` APIs, and requires these to be polyfilled by your application if you wish to support Internet Explorer.
5
+ ## Usage
6
6
 
7
- Graffy Client is intended to be used with a Node.js server running Graffy Server, but should work with any server implementing the [Graffy/HTTP protocol](https://aravindet.github.io/graffy/#/Protocol).
7
+ ```js
8
+ import Graffy from '@graffy/core';
9
+ import client from '@graffy/client';
10
+
11
+ const store = new Graffy();
12
+ store.use(client(url, options));
13
+
14
+ // Add downstream providers to the store
15
+ ```
16
+
17
+ An HTTP connection is used if the URL begins with `http(s)://`, and a Websocket is used if it begins with `ws(s)://`.
18
+
19
+ ### Options
20
+
21
+ - `getOptions(operation, payload, options)`, a callback to get the options that should be passed to the server with each operation.
22
+ - `connInfoPath`, a location in the store to put connection metadata. Defaults to `connection`.
23
+
24
+ ### Connection status
25
+
26
+ If using a WebSocket connection, Graffy client creates a `connection: { status: boolean }` node in the store. The location of this node can be controlled by the `connInfoPath` option. Reading from or watching this node provides information about the current connection status. The application may explicitly tear-down or re-establish connections by writing `false` or `true` to it, respectively.
27
+
28
+ See [Graffy documentation](https://graffy.org#/GraffyClient) for more.
8
29
 
9
- See [Graffy documentation](https://aravindet.github.io/graffy/#/GraffyClient) for more.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@graffy/client",
3
- "description": "Graffy client library for the browser.",
3
+ "description": "Graffy client library for the browser, usin the `fetch()` or `WebSocket` APIs. This module is intended to be used with a Node.js server running Graffy Server.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.15.18",
5
+ "version": "0.15.19-alpha.1",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/common": "0.15.18",
20
- "@graffy/stream": "0.15.18",
19
+ "@graffy/stream": "0.15.19-alpha.1",
20
+ "@graffy/common": "0.15.19-alpha.1",
21
21
  "debug": "^4.3.3"
22
22
  }
23
23
  }