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

305
Vistas
socket.io is not handling connection from socket.io-client from other node.js server

There are two servers and I want to emit some events from server2 to server1 but facing an issue. SERVER1 is working fine when I try to connect it from other client tool(firecamp), but same code is not working when init socket from SERVER2 using socket.io-client. here is code snippets :- SERVER1

socket.io.on('connection', (client) => {

console.log("Socket has been Connected");

client.on("server custom event",(data)=>{
    console.log("custom event");
})
})

OUTPUT OF SERVER1

enter image description here

It continuously connecting and disconnecting socket. but I did not receive any message in SERVER2.

SERVER2 CODE

var ioclient = require("socket.io-client")
var ioc = ioclient.connect('http://localhost:3000');
ioc.on('connect', function () {
// socket connected
console.log("connected");
});
ioc.emit('server custom event', { my: 'data' });

SERVER2 just show the message "server is running on port 8080".

I follow this: Socket IO Server to Server

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