Я установил очень простой канал 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)
})
Эта установка должна выдавать все события из всех моих сервисов featherjs.Однако я получаю событие на моем клиенте только при входе в систему.Когда я впоследствии создаю объекты через мой API-интерфейс перьев, ничего не отображается / никаких событий не происходит.Почему нет?