Redis
Persist output targets with RedisOutputStore.
Source:
examples/redis.ts
Uses REDIS_URL when set; otherwise local Redis defaults. The source owns the
store, and the store owns the client it creates from url.
Set SACN_INTERFACE when the host has multiple NICs — this example opens a real
UDP transport.
import { createSacnSource } from "@helioslx/core";
import { RedisOutputStore } from "@helioslx/core/redis";
import { NodeSacnTransport } from "@helioslx/core/node";
const store = new RedisOutputStore({
...(process.env.REDIS_URL === undefined
? {}
: { url: process.env.REDIS_URL }),
});
const source = createSacnSource({
transport: new NodeSacnTransport({
sourceName: "Helios Redis example",
...(process.env.SACN_INTERFACE === undefined
? {}
: { iface: process.env.SACN_INTERFACE }),
}),
store,
ownsTransport: true,
ownsStore: true,
});
try {
await source.universe(1).fadeChannels({ 1: 255 }, { durationMs: 500 });
} finally {
await source.close();
}Related: Persistence.