In previous articles, we discussed how to get started with and use subscriptions with GraphQL in iOS (and iPadOS, tvOS, and macOS) using Swift programming language.
In previous articles, we discussed how to get started with and use subscriptions with GraphQL in iOS (and iPadOS, tvOS, and macOS) using Swift programming language.
GraphQL main functionality is to fetch and update data from the server. In addition to that subscriptions allow us to listen and to send messages from and to server in real-time. It is similar to regular queries, but the answer will be received when an event happens either on the server or on the client. Apollo iOS SDK library supports subscriptions and it is powered by the Swift WebSocket library Starscream behind the scenes to connect to the server. Let's look at how to set it up and start using it.
GraphQL is an alternative to the commonly used REST API approach. When using GraphQL you only get one single endpoint to the server and through that endpoint you need to specify the exact data you need. It was created by Facebook in 2012 and open-sourced in 2015.