It simply doesnt work. It does nothing, and it's like my emmiter
import type { Prisma } from "@prisma/client";import type { selectnotificacion } from "../api/routers/webcheckinRouter";import { EventEmitter } from "stream";export type TNotification = Prisma.NotificationGetPayload< typeof selectnotificacion>;type NotificationEvents = { add: TNotification[];};const notificationEventEmitter = new EventEmitter<NotificationEvents>();export default notificationEventEmitter;
import type { Prisma } from "@prisma/client";import type { selectnotificacion } from "../api/routers/webcheckinRouter";import { EventEmitter } from "stream";export type TNotification = Prisma.NotificationGetPayload< typeof selectnotificacion>;type NotificationEvents = { add: TNotification[];};const notificationEventEmitter = new EventEmitter<NotificationEvents>();export default notificationEventEmitter;
has 0 clients. (But the subscription is still connected according to the logger)
Solution
I use redis for my project https://github.com/bebore/ei-noah-bot but that's quite complex, I recommend just following the redis package docs. It's not much different from the event emitter other than that you need to (de)serialize the input and output.