My goal is to create an application that I can use to manage pub/sub for various clients. The application should be able to receive new topics via an API and then accept subscribers via a websocket connection.
I have it working, but am aware the current solution has many flaws. It works currently as follows:
I have a chicago_boss app, that has a websocket endpoint for clients to connect to, once the client connects, I add the Pid for that Websocket connection to a list in Redis.
- Client connects to "ws://localhost:8001/websocket/game_notifications"
- The Pid for that Websocket connection is added to Redis using LPUSH game_notifications_pids "<0.201.0>". 3.The last 10 messages in Redis for game_notifications are sent to the websocket Pid
- A new message is posted to "/game_notifications/create"
- Message is added to redis using LPUSH game_notifications "new message"
- All Pids in Redis with key game_notifications_pids are sent this new message
- On closing of the websocket the Pid is deleted from the Redis list
Please let me know what problems people see with this setup? Thanks!