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.