-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Very pleased with this package. Glad I won't need to roll my own solution haha. I was wondering if we could expose a higher-order function to decorate an existing network interface? I am currently doing the following for subscriptions:
import { print } from 'graphql-tag/printer';
// quick way to add the subscribe and unsubscribe functions to the network interface
export default function addGraphQLSubscriptions(networkInterface, wsClient) {
return Object.assign(networkInterface, {
subscribe(request, handler) {
return wsClient.subscribe({
query: print(request.query),
variables: request.variables,
}, handler);
},
unsubscribe(id) {
wsClient.unsubscribe(id);
},
});
}It seems like this will be a normal pattern moving forward for extended the default apollo network interface. I don't think it would be too difficult to expose an interface for something like this, and I am willing to submit a PR if you don't have time for it.
Thoughts @HriBB ?
sandervanhooft and jaydenseric
Metadata
Metadata
Assignees
Labels
No labels