Gjergj Kadriu
Gjergj Kadriu

Reputation: 598

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?

Upvotes: 0

Views: 534

Answers (1)

Marco Daniel
Marco Daniel

Reputation: 5765

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.

Upvotes: 1

Related Questions