Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!