graphql-subscriptions-client
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -5,2 +5,3 @@ import Backoff from 'backo2' | ||
const WS_MINTIMEOUT = 1000 | ||
const WS_TIMEOUT = 30000 | ||
@@ -20,2 +21,3 @@ | ||
connectionParams = {}, | ||
minTimeout = WS_MINTIMEOUT, | ||
timeout = WS_TIMEOUT, | ||
@@ -33,2 +35,3 @@ reconnect = false, | ||
this.nextOperationId = 0 | ||
this.wsMinTimeout = minTimeout | ||
this.wsTimeout = timeout | ||
@@ -213,3 +216,3 @@ this.unsentMessagesQueue = [] | ||
createMaxConnectTimeGenerator() { | ||
const minValue = 1000 | ||
const minValue = this.wsMinTimeout | ||
const maxValue = this.wsTimeout | ||
@@ -216,0 +219,0 @@ return new Backoff({ |
{ | ||
"name": "graphql-subscriptions-client", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "A simpler client for graphql subscriptions based on apollographql/subscriptions-transport-ws", | ||
@@ -20,5 +20,5 @@ "main": "client.js", | ||
"backo2": "^1.0.2", | ||
"eventemitter3": "^3.1.0", | ||
"eventemitter3": "^3.1.2", | ||
"symbol-observable": "^1.2.0" | ||
} | ||
} |
@@ -11,23 +11,4 @@ # graphql-subscriptions-client | ||
First you encounter the following error: | ||
I found that the imports from the graphql module were causing problems and that I didn't have much need for them. This module ends up being therefore much smaller and simpler, but one difference is that queries **must be strings** and it only uses native WebSocket, so you may end up with problems if you aren't targeting modern browsers or if you like using graphql-tag's gql template string functions to define your queries. | ||
`[!] Error: 'SubscriptionClient' is not exported by node_modules/subscriptions-transport-ws/dist/index.js` | ||
This you can fix by replacing the call to `commonjs()` with the following: | ||
```javascript | ||
commonjs({ | ||
include: "node_modules/**", | ||
namedExports: { | ||
"node_modules/subscriptions-transport-ws/dist/index.js": [ | ||
"SubscriptionClient" | ||
] | ||
} | ||
}), | ||
``` | ||
But then you discover that the package makes reference to a lot of global variables that rollup doesn't know what to do with. So you add the builtins and globals plugins and try to build again and now you have "(!) `this` has been rewritten to `undefined`" and you think that doesn't sound right. You look it up and maybe it makes sense, but what to do now? | ||
You may have slightly different results. I found that the imports from the graphql module were causing problems and that I didn't have much need for them. This module ends up being therefore much smaller and simpler, but one difference is that queries must be strings and it only uses native WebSocket, so you may end up with problems if you aren't targeting modern browsers. | ||
### Subscriptions without apollo-client | ||
@@ -56,2 +37,6 @@ | ||
reconnect: true, | ||
lazy: true, // only connect when there is a query | ||
connectionCallback: error => { | ||
error && console.error(error) | ||
} | ||
}); | ||
@@ -58,0 +43,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
467
18368
64
Updatedeventemitter3@^3.1.2