Skip to content

Instantly share code, notes, and snippets.

@Mattchewone Mattchewone/service.js Secret
Created Feb 22, 2019

Embed
What would you like to do?
Example service file for publish
service.publish((data, context) => {
// Only publish if we are from an internal emit
// Only publish the new record to the user within the context
if (context.hookEmit) {
return app.channel(app.channels)
.filter(connection => connection.user && connection.user._id.toString() === context.userId.toString())
.send(data)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.