I am new to GraphQL and need some help...
As I see there is a plenty of components in GraphQL such as Query, Mutation and Subscription. In Angular Apollo Client I have two methods to deal with Query: apollo.query and apollo.watchQuery. As I understand query method gets the data only once when watchQuery constantly watches for updates. And if so what is the difference between watchQuery and GraphQl subscription?
As stated in the oficial apollo docs: "GraphQL subscriptions are a way to push data from the server to the clients that choose to listen to real time messages from the server. Subscriptions are similar to queries in that they specify a set of fields to be delivered to the client, but instead of immediately returning a single answer, a result is sent every time a particular event happens on the server."
So the subscription is just listening for some push alterations from the backend, and instead, the watchQuery is a query that whenever that query will be refetched or the data related to that query is changed from anywhere else, this method will keep on emitting the updated data.
I dont know if you are confusing watchQuery with "live query", but live queries are not supported yet.