-
-
Notifications
You must be signed in to change notification settings - Fork 797
Description
We have just migrated to feathers v4 from v3.
We had a working chat room feature, but now, new service creation events (corresponding to new messages) are not being appropriately published on our custom channels:
app.service('messages').publish('created', (data, context) => {
console.log('messages created event fired')
console.log(app.channel(`convo/${data.conversationId}`).connections)
return [app.channel(`convo/${data.conversationId}`)];
});
When we create a new message, this code block is triggered and the console statements here indicate that there is at least one active connection in the conversation corresponding to the conversationId. Yet the client doesn't receive any new message events.
Another clue is that when I change the code to leave users in the anonymous channel and publish this event to the anonymous channel, the client does receive the update appropriately:
app.service('messages').publish('created', (data, context) => {
console.log('messages created event fired')
console.log(app.channel(`convo/${data.conversationId}`).connections)
console.log(app.channel('anonymous').connections) // Shows identical connections as the line above
return [app.channel('anonymous'), app.channel(`convo/${data.conversationId}`)];
});
Because the client code receives these events when published over the anonymous channel, it leads me to believe this is a server-side issue.
Module versions (especially the part that's not working):
NodeJS version: v10.16.3
Operating System: Mac OS X 10_12_2
Browser Version: Chrome/77.0.3865.120
Module Loader: Webpack