Skip to content

Commit

Permalink
update redis client and npm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
floodfx committed Jan 12, 2023
1 parent 09246f7 commit bf7359f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions packages/express/src/node/redisPubSub.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { RedisClientOptions, RedisClientType } from "@node-redis/client";
import {
createClient,
RedisClientOptions,
RedisClientType,
RedisFunctions,
RedisModules,
RedisScripts,
} from "@redis/client";
import crypto from "crypto";
import { createClient } from "redis";
import { Publisher, Subscriber, SubscriberFunction } from "liveviewjs";

type RedisClient = RedisClientType<RedisModules, RedisFunctions, RedisScripts>;

/**
* A PubSub implementation that uses Redis as a backend.
* e.g. new RedisPubSub({ url: process.env.REDIS_URL || "redis://localhost:6379" })
*
* See: https://github.com/redis/node-redis#pubsub
*/
export class RedisPubSub implements Subscriber, Publisher {
private redis: RedisClientType;
private subscribers: Record<string, RedisClientType> = {};
private redis: RedisClient;
private subscribers: { [key: string]: RedisClient } = {};

constructor(options: RedisClientOptions) {
this.redis = createClient(options);
Expand Down

0 comments on commit bf7359f

Please sign in to comment.