How to filter feathers Js services to publish real-time just on Chanel
service.on('created', (message, context) => {
console.log('message created');
return app.channel(`conversation-${message.ConversationId}`);
this code does not seem to filter the message to the conversation room desired
I read the discussion here: https://github.com/feathersjs/feathers/issues/388 I can see the service.filter function was removed
If you look at the standard channels.js file you can see an example how filtering would work. First, the user has to be put into all conversation channel they are a part of on app.on('login')
. Then you call service.publish() once to register a publisher for the event:
service.on('publish', (message, context) => {
console.log('message created');
return app.channel(`conversation-${message.ConversationId}`);
});