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

151
Vistas
Get a reference to the event listener from a middleware

Is there a way to get a reference to the event listener as in the following stub?

socket.on('login',login)

Could I get a reference to socket inside the function login?

// Login module

module.exports = ({username, password}, next) => {
   // How to refer socket here?
}

I cannot pass socket into the middleware, as the library I am using underneath doesn't recognize the third argument and I would not want to alter its regular behavior.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

login.bind({socket: socket}) Then in login function use this.socket

over 4 years ago · Santiago Trujillo 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