Javascript feathersjs通道的事件不会传递到客户端

Javascript feathersjs通道的事件不会传递到客户端,javascript,feathersjs,Javascript,Feathersjs,我设置了一个非常基本的Featherjs频道。因此,在服务器上,我有: module.exports = app => { // If no real-time functionality has been configured just return if (typeof app.channel !== 'function') return app.on('connection', connection => { // On a new real-time c

我设置了一个非常基本的Featherjs频道。因此,在服务器上,我有:

module.exports = app => {
  // If no real-time functionality has been configured just return
  if (typeof app.channel !== 'function') return

  app.on('connection', connection => {
    // On a new real-time connection, add it to the anonymous channel
    app.channel('anonymous').join(connection)
  })

  app.on('login', (authResult, {connection}) => {
    // connection can be undefined if there is no
    // real-time connection, e.g. when logging in via REST
    if (connection) {
      // Obtain the logged in user from the connection
      const {user} = connection

      // When the connection is no longer anonymous (as you the user is logged in), remove it
      app.channel('anonymous').leave(connection)

      // Add it to the authenticated user channel
      app.channel('authenticated').join(connection)
    }
  })

  app.publish((data, hook) => {
    return app.channel('authenticated')
  })

  app.service('points').publish('created', () => app.channel('authenticated'))
}
在我的客户中:

api.on('authenticated', response => {
  console.log('Yes, here is the event from the channel: ', response)
})
此设置应提供所有my featherjs服务中的所有事件。但是,我只有在登录时才能在客户端上获得一个事件。当我随后通过feathers api服务创建对象时,不会显示任何内容/不会出现任何事件。为什么不呢?

是一个纯客户端事件,当客户端成功进行身份验证时将触发该事件。它不是从服务器发送的事件

通道仅适用于从服务器发送的数据。对于您的示例,这意味着使用

app.service('points').on('created', point => {})

在客户机上。客户端只有在经过身份验证后才会收到
创建的
事件。

是的,频道的类似命名和特定的非相关身份验证事件让我大吃一惊。但是现在很清楚了,谢谢!如果可以在文档中做一些事情来改善这一点,请随意创建问题或向提交PR