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

193
Views
Socket.IO server + Socket.IO-client

Im actually desperate now. I need to design and code solution I've never even thought I'd be making, and it seems completely unrealistic to achieve (for me) with clean express. But I might be wrong.

What I need is:

  • REST API - done
  • Socket.IO server - done
  • bunch of Socket.IO-client connections - can be done

But now, what I need is to some efficient way of making it, to communicate with each other. So the app has to be basically a bridge between all of them. I was thinking of using some kind of state managing library, like Redux solution, that way I (at least I think) could achieve it pretty easy. But I also haven't found any of this kind, for the node, or neither found how to achieve it on the backend.

So the question is: what's the best solution, to achieve one-to-many and many-to-one communication between multiple socket.io connections? Again, to make it clear.

socket-client connection = connecting to already existing server, as a node app.

I am not speaking of making simple solution for clients to communicate between each other on 1 server. I want to create 1 server, and to connect to multiple others.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Okay, so, what you probably want to do is to create one "server" application, then connect your Electron app as well as the bots as clients to that server.

For the bots, which would be running as their own node scripts, you would be using the socket.io-client package, and then use that the same way you use the client in the browser. Call io() with your connection settings, get a socket from that, and start binding your events as usual:

let io = require('socket.io-client');
let socket = io('http://YOUR_SERVER_IP/');

socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});

If you want to tell the difference between the bots and the Electron clients, I would send out some special event on connect, that your server can then handle:

socket.on('connect', function(){
    socket.emit('identify_as_bot', {id: IDENTIFIER})
});

I hope that helps.

about 4 years ago · Santiago Trujillo Report
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!