Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

769 B
Raw Blame
import type { NotificationsSchemaTypeForSelect } from 'taskview-db-schemas';
import { getCentrifugoClient } from '../../../core/CentrifugoClient';
import type { NotificationMeta, NotificationProvider } from '../NotificationProvider';
import { NotificationChannel } from '../types';

export class CentrifugoProvider implements NotificationProvider {
    readonly channel = NotificationChannel.WEBSOCKET;

    async send(userId: number, notification: NotificationsSchemaTypeForSelect, meta: NotificationMeta): Promise<void> {
        await getCentrifugoClient().publishToUser(userId, 'notification', {
            notification,
            goalId: meta.goalId,
            goalListId: meta.goalListId,
            organizationId: meta.organizationId,
        });
    }
}