@graphql-live/client
Advanced tools
Comparing version 0.1.8 to 0.1.9
{ | ||
"name": "@graphql-live/client", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "The client part of the GraphQLive package", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# @graphql-live/client | ||
> **⚠ WARNING: Still under development.** | ||
Very tiny library to send **live queries** to a compatible GraphQL server ([`@graphql-live/server`](https://www.npmjs.com/package/@graphql-live/server)) using the `@live` directive and automatically get updates when fresh data is available. Under the hood, the client uses Socket.IO to communicate and receives JSON patches to perform surgical updates of previous results _(side note : you don't have to think about it)_, thus optimizing bandwidth usage. | ||
Of course, it also supports standard queries and mutations (subscriptions might come in the futur). | ||
## Install | ||
@@ -116,15 +120,23 @@ | ||
url: "http://localhost:8080", | ||
exchanges: [ | ||
dedupExchange, | ||
cacheExchange(), | ||
liveExchange({ | ||
url: "http://localhost:8080", | ||
context() { | ||
return auth().currentUser.token; | ||
} | ||
}) | ||
] | ||
context() { | ||
return auth().currentUser.token; | ||
} | ||
}); | ||
``` | ||
_Note: `createClient`, `LiveLink` and `liveExchange` all accept the same options._ | ||
### Custom path | ||
You can pass any valid Socket.IO client options to the live query client, including a custom `path` : | ||
```javascript | ||
const client = createClient({ | ||
url: "http://localhost:8080", | ||
socketOptions: { | ||
path: "/api" | ||
} | ||
}); | ||
``` | ||
## API | ||
@@ -131,0 +143,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
283675
199