From the course: Learning GraphQL (2021)
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Working with subscriptions - GraphQL Tutorial
From the course: Learning GraphQL (2021)
Working with subscriptions
- [Instructor] So far, we know that queries get data and mutations change data, but there is even a third type of GraphQL operation called a subscription. A GraphQL subscription works over web sockets and it sets up a listener. So, let me show you how this works. I could create a subscription for liftStatusChange, grab the name and the status. And now I'm going to go ahead and click play. This is going to listen for any data changes in real time. And then if a status has changed over here in another panel, we're going to see all of these comeback in the browser immediately. So again, unlike a query, which we just send the query, we get a response, a subscription, we set up a listener. So, we're listening for any of those changes. As soon as they come in, they will be present here in our user interface. So, this is pretty cool. A subscription sets up kind of that real-time feel in your application. These were first…