-
-
Save homerquan/ec2ae59ebe3b7da02cf4ec4e6bc9c7a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { withFilter } from 'graphql-subscriptions'; | |
... | |
Subscription: { | |
watchDevice: { | |
resolve: (payload) => payload, | |
subscribe: withFilter( | |
() => pubsub.asyncIterator(deviceConstants.UPDATE_DEVICE), | |
(payload, args) => payload._id.toString() === args.id, | |
), | |
}, | |
watchDevices: { | |
resolve: (payload) => payload, | |
subscribe: () => pubsub.asyncIterator([deviceConstants.UPDATE_DEVICE, deviceConstants.CREATE_DEVICE]), | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment