Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of @aws_subscribe annotation?

I am reading realtime data documentation but do not understandwhat is the purpose of @aws_subscribe. Could somebody explain this in simple English? Examples about how subscriptions works with/without annotation will help a lot.

like image 216
Cherry Avatar asked Sep 16 '25 08:09

Cherry


1 Answers

Using the @aws_subscribe directive, you can declare the mutations a subscription is subscribed to. For example:

type Mutation {
  createPost(): Post
  editPost(): Post
  deletePost(): Post
}

type  Subscription {
  updatedPost(): Post
    @aws_subscribe(mutations: ["createPost","editPost","deletePost"])
}
like image 66
Rick Foxcroft Avatar answered Sep 19 '25 09:09

Rick Foxcroft