Skip to content

Support fetch-based SSE subscriptions (graphql-sse / Apollo Client) #196

@vasily-polonsky

Description

@vasily-polonsky

Is your feature request related to a problem? Please describe.
I'm using graphql-sse with Apollo Client following the official recipe: https://the-guild.dev/graphql/sse/recipes#with-apollo

The graphql-sse library uses the Fetch API internally (not the native EventSource API) because it needs to send POST requests with a GraphQL operation body — something EventSource doesn't support (GET only).

As a result, Chrome categorizes these requests as fetch type instead of eventsource type. The extension correctly detects SSE connections via the Accept: text/event-stream header in Network.requestWillBeSent, but Network.eventSourceMessageReceived is never fired by Chrome for fetch-based streaming responses — so subscription messages are never captured.

Describe the solution you'd like
Support fetch-based SSE streaming responses in addition to native EventSource. When a request with Accept: text/event-stream is detected and the response has Content-Type: text/event-stream, the extension should parse the SSE event stream from the response body using Network.dataReceived or Fetch.dataReceived Chrome DevTools Protocol events, rather than relying solely on Network.eventSourceMessageReceived.

Additional context
graphql-sse is the most widely used SSE library for GraphQL subscriptions (by The Guild). Its Apollo Client integration always uses fetch() because the GraphQL subscription query must be sent in the POST body. This means the extension currently cannot track subscriptions for any graphql-sse user.

The relevant code in useSSEListener.ts that relies on Network.eventSourceMessageReceived: https://github.com/warrenday/graphql-network-inspector/blob/master/src/hooks/useGraphqlSubscriptions/useSSEListener.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions