Version: 0.14.x

Subscriptions

Subscriptions are divided into three groups of changes: Create, Update and Delete.

  • new<Type>: subscribe to the Create mutation event.
  • updated<Type>: subscribe to the Update mutation event.
  • deleted<Type>: subscribe to the Delete mutation event.

Graphback generates a subscription handler and filter input for each CRUD mutation field to let you subscribe to mutation events and receive real-time updates.

""" @model """
type Note {
id: ID!
title: String!
likes: Int
}
input NoteSubscriptionFilter {
id: ID
title: String
likes: Int
}
type Subscription {
newNote(filter: NoteSubscriptionFilter): Note!
updatedNote(filter: NoteSubscriptionFilter): Note!
deletedNote(filter: NoteSubscriptionFilter): Note!
}
caution

Subscription filtering is not available yet and will be implemented in a future release.

Examples

Subscribing to a create event on Note:

subscription {
newNote {
id
title
likes
}
}

Subscribing to a update event on Note:

subscription {
updatedNote {
id
title
likes
}
}

Subscribing to a delete event on Note:

subscription {
deletedNote {
id
title
likes
}
}