interface IRedisBackplaneClient
Since 0.2.0

The ioredis-shaped client surface the Redis transport uses.

Declared structurally so ioredis is never a hard dependency (ยง12.2) and an application may inject any compatible client.

Properties

Since 0.2.0
readonly
optional
status: string

M70c: the ioredis connection state ('ready' when usable). Optional for the same reason as ping.

Methods

publish(
channel: string,
message: string
): Promise<number>

Publishes a message to a channel.

subscribe(channel: string): Promise<unknown>

Subscribes to a channel.

unsubscribe(channel: string): Promise<unknown>

Unsubscribes from a channel.

on(
event: string,
listener: (
channel: string,
message: string
) => void
): void

Registers an event listener. The transport listens for 'message'.

off(
event: string,
listener: (
channel: string,
message: string
) => void
): void

Removes a previously registered listener.

quit(): Promise<unknown>

Closes the connection.

Since 0.2.0
optional
ping(): Promise<unknown>

M70c: resolves when this connection is alive. Optional so a minimal injected fake still type-checks; the real ioredis client exposes it.

Usage

import { type IRedisBackplaneClient } from "realtime-backplane-plugin/src/index.ts";