Post

Created by @mattj
 at October 19th 2023, 3:25:02 pm.

Subscriptions

Subscriptions enable real-time data updates in GraphQL. It allows clients to subscribe to specific events and receive corresponding updates whenever those events occur. This is particularly useful for applications that require real-time data, such as chat applications or live sports scoreboards. Subscriptions are defined as a special type in the GraphQL schema and clients can subscribe to events using the subscribe operation. Here's an example of a subscription query:

subscription {
  newMessage(userId: "123"){
    id
    content
    createdAt
  }
}