Closed andrecavallari closed 4 years ago
Well, got this working, but I really think that should be improved the documentation, maybe latter I submit a PR improving this doc.
For anyone trying to do the same:
await driver.subscribe('stream-notify-logged', 'user-status')
const userStatusCollection = driver.asteroid.getCollection( 'stream-notify-logged' )
userStatusCollection.reactiveQuery({}).on('change', function(_id) {
const query = userStatusCollection.reactiveQuery({ _id }).result[0].args[0]
const [userId, username, status] = query
console.log(userId, username, status)
})
Well, I need to subscribe to stream-notify-logged listening to 'user-status', then I used the method:
await driver.subscribe('stream-notify-logged', 'user-status')
But, how to listen to the changes on this?I tryed the following:
But only returns a string "id" when any user changes it's status
Any ideas??