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

165
Vistas
How to have two backend nodejs servers communicate with each other to handle different tasks with k8s in mind

I have an express server that handles all authentication(using token auth and have redis store sessions to control the amount of logins per device) and reading/writing to mongoDB.

I want to add chat for my users(using socket.io and socket.io-redis) and instead of coding it within the current backend I was wondering how I could keep it separate or if that is even a good idea.

I thought it would be because I'm deploying on a k8s cluster but I was wondering how to go about the communication between these two servers.

I'm using ingress nginx controller where I open up traffic to the backend in the load balancer. At first I thought I would be routing all traffic from the backend between the chat server and the users. But that's not the case as the chat server needs to connect to the users directly? So how would I secure the communication between the backend to the chat server as well as the communication between the chat server and the users?

Maybe I'm overthinking this but any insight is appreciated.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

What I ended up doing was creating an Auth server, a Main API server and a Chat server. The frontend pointing to auth.domain.com, api.domain.com, chat.domain.com.

The Auth server generates a JWT that is stored in redis when a user logs in. The Main API server and Chat server check redis to make sure the JWT is valid and then executes.

Because all this is running on a k8s cluster and can have multiple instances, I used Pub/Sub so even if a user isn't on the same websocket server(chat server), they will still receive.

over 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