import { Command, type CommandOptions } from "./command"; /** * @see https://redis.io/commands/psubscribe * @see node_modules/@upstash/redis/docs/commands/pubsub/psubscribe.mdx */ export class PSubscribeCommand extends Command { constructor(cmd: [...patterns: string[]], opts?: CommandOptions) { const sseHeaders = { Accept: "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive", }; super([], { ...opts, headers: sseHeaders, path: ["psubscribe", ...cmd], streamOptions: { isStreaming: true, onMessage: opts?.streamOptions?.onMessage, signal: opts?.streamOptions?.signal, }, }); } }