Keys auf SSE umgestellt

This commit is contained in:
Bastian Wagner
2026-03-05 14:51:45 +01:00
parent f88fe93182
commit ac2117b64b
13 changed files with 217 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
import { Injectable,MessageEvent } from '@nestjs/common';
import { Subject } from 'rxjs';
import { Key } from 'src/model/entitites';
@Injectable()
export class SseService {
private clients = new Map<string, Subject<MessageEvent>>();
sendKeysToUsers(userId: string, keys: Key[]) {
try {
const sub = this.clients.get(userId);
if (!sub) { return; }
sub.next({ data: keys })
} catch {}
}
register(userId: string) {
const subj = new Subject<MessageEvent>();
this.clients.set(userId, subj);
return subj;
}
}