apollographql / embeddable-explorer

MIT License
35 stars 12 forks source link

Initial connection to "Subscription Endpoint" missing headers #306

Open leeamoore opened 1 month ago

leeamoore commented 1 month ago

I'm using the ApolloSandbox embedding in my application. It's been great! It's been my favorite GraphQL playground interface that I've used.

I'm running into an issue with subscriptions. During the initial connection when making a GraphQL subscription query, the shared headers are not passed in the initial payload of the graphql-ws request. Further, this failure causes my embedding of the GraphQL Explorer to retry the graphql-ws request in an infinite loop due to the authentication failure from a missing authentication token in the initial payload. Setting the subscription implementation to graphql-ws instead of "Auto-detect" before sending the initial requests prevents this issue from happening.

Is there a way to set the subscription implementation in the props of ApolloSandbox? If not, it would be nice to have that option. I'm happy to submit a PR for this if I can get pointed in the right direction.