0

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.

  1. Client connects to "ws://localhost:8001/websocket/game_notifications"
  2. 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
  3. A new message is posted to "/game_notifications/create"
  4. Message is added to redis using LPUSH game_notifications "new message"
  5. All Pids in Redis with key game_notifications_pids are sent this new message
  6. 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!

BC00
  • 1,589
  • 3
  • 29
  • 47
  • This question is too broad. We don't know, if you need any guarantees on message delivery. For starters, you can use `mnesia`, instead of `redis`. Mnesia is capable of storing pids, without converting them first to string. Next, you can use `tinymq`, which is part of CB and provides the pub/sub functionality. If you need guarantees in message delivery, than probably RabbitMQ would be better... I think, that this question doesn't meet SO standars. – tkowal Jan 19 '15 at 19:14
  • @tkowal, thanks, I will need guarantees of message delivery – BC00 Jan 19 '15 at 19:32
  • As a follow-up of @tkowal's answer http://vanbosse.be/blog/detail/pub-sub-with-rabbitmq-and-websocket – Evan P Jan 20 '15 at 11:09

0 Answers0