Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
Can't listen to event sent from feathers server to client

I'm building a server which uses feathers and socketio.

I'm trying to use feathers channels mechanism to notify relevant users (connections) on relevant events.
Users belong to groups, so upon connecting to the server, I add the connection to the appropriate channels.
Upon publishing, inside app.publish, I'm getting the right data and see that the connection is attached to the channel, but can't figure out how to listen to it on the client.

This is a simplified channels.js:

app.on('connection', async (connection) => {
    connection.userGroups.forEach((group) => {
        app.channel(`group.groupId`).join(connection);
    }
    app.channel('1').join(connection); // dummy channel
}

app.publish((data, context) => {
    console.log(app.channel('1')); // output shown below
   
    return app.channel('1');
});

I'm using Postman as the client, sending a patch request, and listening to event named rooms patched (rooms is my service name) as described in feathers docs. No event is arriving.
If I'm using the raw socketio instance and emitting from there, everything seems to work fine and I get the event in the client

app.io.sockets.in('some room').emit('rooms patched', data);

but as I understand it, it overrides the whole mechanism of channels.

By examining the output from app.publish

Channel {
  _events: [Object: null prototype] {
    empty: [Function: bound onceWrapper] { listener: [Function (anonymous)] }
  },
  _eventsCount: 1,
  _maxListeners: undefined,
  connections: [
    {
      provider: 'socketio',
      headers: [Object],
      userInfo: [Object],
      userGroups: [Array]
    }
  ],
  data: null,
  [Symbol(kCapture)]: false
}

we can see that the connection is there.

Can anyone help me figure this problem out?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Does a port need to be opened on the clients end to create the channel so the communication line is 2 ways. Perhaps javascript will have some code to open up the clients port.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Found my silly typo mistake...
I accidently wrote

app.channel(`group.groupId`).join(connection);

when it really should be

app.channel(group.groupId).join(connection);

That's a shame really.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda