Skip to main content
Module

x/r2d2/mod.ts>listenReplies

Fast, lightweight Redis client library for Deno.
Go to Latest
variable listenReplies
Deprecated
Deprecated

Use readReplies instead. This will be removed in v1.1.

import { listenReplies } from "https://deno.land/x/r2d2@v1.1.0/mod.ts";

Used for pub/sub. Listens for replies from the Redis server.

Example:

import { writeCommand, listenReplies } from "https://deno.land/x/r2d2@$VERSION/mod.ts";

const redisConn = await Deno.connect({ port: 6379 });

await writeCommand(redisConn, ["SUBSCRIBE", "mychannel"]);

for await (const reply of listenReplies(redisConn)) {
  // Prints ["subscribe", "mychannel", 1] first iteration
  console.log(reply);
}