简体   繁体   中英

How to filter feathersjs service

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}`);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM