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

195
Vistas
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 Respuestas
Responde la pregunta

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 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