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

201
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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