Understanding GraphQL subscriptions
When interacting with a GraphQL server, you'll often get and write data using queries and mutations. In this situation, the client must send a query or mutation to the server in order to obtain a response.
Subscriptions are another form of data communication in GraphQL, in which the server provides realtime data to listening clients.
In order to do that, the client opens a two-way communication with the server, which can be done with protocols such as WebSocket instead of HTTP. WebSocket can be used to make two-way communication between the user's browser and a server.
Subscriptions are similar to queries. However, they let subscribing clients receive fresh or updated data whenever a certain server event happens. You may configure Apollo Server to use a subscription-specific endpoint that is distinct from the default endpoint for queries and mutations.
We will be able to add realtime capabilities to our social network application...