graphql-playground
graphql-playground copied to clipboard
Custom fetcher
It should be possible to add a customer fetcher like possible in GraphiQL.
According to the doc, this seems possible now
https://github.com/graphcool/graphql-playground#as-react-component
Actually looking at the code, Playground component does not have a fetcher prop so it seems the documentation is incorrect and this still need to be addressed.
I guess once custom fetcher is supported, it will take care of executing subscriptions as well and so it will make how subscriptions are actually handled pluggable at the same time so that it might not be really necessary to introduce Apollo Link as suggested in #195
@timsuchanek can you confirm that your plan for a custom fetcher would be able to handle subscriptions as well ?
@tlvenn sorry for getting back so late.
The custom fetcher would not only be able to, but would have to handle subscriptions.
As you see here, we're checking if it is a subscription. https://github.com/graphcool/graphql-playground/blob/master/packages/graphql-playground-react/src/components/Playground.tsx#L972 The fetcher then needs to return an observable.
For anyone interested in tackling this, the property would need to be passed from MiddlewareApp.tsx to Playground.tsx.
Is setting a custom fetcher possible yet?
Is this solved in https://codesandbox.io/s/mvmoeex1 ?