8

Situation: I have a small chat app with two users in each room. Lets call'em Sender and Receiver.

I'd like to make 'read/unread messages'.

To determine if Sender's message is currently being read he needs to know if Receiver is currently subscribed to the channel.

I'm trying to look through subscriptions:

# I can retrieve subscriptions from Redis:
redis_record = Redis.new.pubsub("channels", "action_cable/*")
# I can make such id
key = Base64.encode64("gid://test-app/User/1").tr('=', '').tr('actioncable/', '').chomp

But I don't know how to look for existing record. Tried:

Redis.new.scan(0, match: key)

With no result.

Question: how to find out if subscription is active? (using Redis is not a keypoint, maybe ActionCable has something to do with it somewhere inside the box)

Alexander Gorg
  • 1,049
  • 16
  • 32

0 Answers0