graphql-http-ws-client
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -35,5 +35,10 @@ import {concat, split} from "apollo-link"; | ||
const websocketImplementation = (typeof options.websocket === 'function') ? options.websocket : window.WebSocket; | ||
subscriptionClient = new SubscriptionClient(httpURLToWS(graphQLURL), { | ||
reconnect: true, | ||
}, websocketImplementation); | ||
subscriptionClient = new SubscriptionClient(httpURLToWS(graphQLURL), Object.assign( | ||
{ | ||
reconnect: true | ||
}, | ||
filterObject(options, ['reconnect', 'timeout', 'lazy', 'reconnect', 'reconnectionAttempts', 'connectionCallback', 'inactivityTimeout', 'connectionParams']) | ||
), websocketImplementation); | ||
websocketLink = new WebSocketLink(subscriptionClient); | ||
@@ -71,3 +76,12 @@ } | ||
subscriptionClient: subscriptionClient | ||
}; | ||
function filterObject(rawObject, filterKeys) { | ||
return Object.keys(rawObject) | ||
.filter(key => filterKeys.includes(key)) | ||
.reduce((filteredObject, key) => { | ||
filteredObject[key] = rawObject[key]; | ||
return filteredObject; | ||
}, {}); | ||
} | ||
} |
{ | ||
"name": "graphql-http-ws-client", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "author": { |
6261
93