AppSync supports GraphQL subscriptions out of the box! We don't even have to write custom code.
All we have to do is create a Subscription type in our GraphQL schema with @aws_subscribe(), and pass that the mutation we want to subscribe to.
@aws_subscribe()