Search code examples
graphqlsubscription

Graphql subscriptions client-side http request


Is it possible to use subscriptions with simple http requests similarly to query,mutation where I just have to send a POST request with "application/graphql" Content-Type, and body?


Solution

  • No, it is not possible to do it.

    In GraphQL, subscriptions are subscribing to a websocket and listening to data changes and it reacts to custom events, so it is not something you can query with a POST request.

    As stated on the documentation at Apollo Client Subscriptions.

    Now, queries and mutations will go over HTTP as normal, but subscriptions will be done over the websocket transport.