redis icon indicating copy to clipboard operation
redis copied to clipboard

Support multiple subscriptions to one Redis channel

Open jonahsnider opened this issue 1 year ago • 0 comments

In @adonisjs/redis, trying to do redis.subscribe() when the specified channel already has an active subscription will throw an error.

It would be nice if instead of throwing, @adonisjs/redis was able to intelligently group duplicate subscriptions together.

redis.subscribe('users/123', callback); // opens connection

// later...
redis.subscribe('users/123', callback); // reuses existing subscription

@adonisjs/redis is described as "The package is a thin wrapper on top of ioredis with better DX around Pub/Sub and automatic management of multiple redis connections", so this feature seems very inline with the package's goals.


Originally posted as a discussion here

jonahsnider avatar Jul 02 '24 04:07 jonahsnider