Currently we can only subscribe to a single channel with the subscribe(). This PR allows the user to subscribe to multiple channels - just like https://redis.io/commands/subscribe.
import redis, asyncdispatch
var isSub: bool
var c: AsyncRedis
proc dd() {.async.} =
while true:
if not isSub:
c = await openAsync()
await c.subscribe(@["files", "users"])
isSub = true
let data = await c.nextMessage()
echo $data
when isMainModule:
asyncCheck dd()
runForever()
$ redis-cli
#Received
publish files newFile
#Not received
publish ula bla
#Received
publish users John
Currently we can only subscribe to a single
channel
with thesubscribe()
. This PR allows the user to subscribe to multiple channels - just like https://redis.io/commands/subscribe.