Last active
December 21, 2017 16:56
-
-
Save jmn8718/89084599c8ba9c550eb3133ef892dc5b 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