E40C Events not published correctly over channels after v3 to v4 migration · Issue #1641 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Events not published correctly over channels after v3 to v4 migration #1641

@wgley3

Description

@wgley3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0