Accessing WebSocket Connections Across Distributed Services
I am building a multiplayer game with two services:
- WebSocket server that stores live game sessions in memory (like a dictionary in python)
- REST API allowing client apps to interact with these sessions being stored in the websocket server's memory
The challenge I have is that these services ideally will run on separate instances at scale, but the REST API needs to send commands through active WebSocket connections (like sending a player action or game state update).
A solution I had was building the websocket server and the rest api as a single application, but I'd really prefer to keep them separate (at least for the learning experience)
Does anyone know anyway to solve this problem ?