Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

307
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda