Unregister & Unsubscribe vom SSE für Keys eingebaut

This commit is contained in:
Bastian Wagner
2026-03-09 12:59:59 +01:00
parent b3fd7fbf03
commit 1480e8d7b2
4 changed files with 40 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ import { Controller, Get, Param, Query, Req, Sse, UnauthorizedException, UseGuar
import { AuthenticatedRequest } from 'src/model/interface/authenticated-request.interface';
import { SseTicketService } from './sse-ticket.service';
import { AuthGuard } from 'src/core/guards/auth.guard';
import { Observable } from 'rxjs';
import { finalize, Observable } from 'rxjs';
import { SseService } from './sse.service';
@Controller('sse')
@@ -23,6 +23,10 @@ export class SseController {
if (!userId) throw new UnauthorizedException('Invalid/expired ticket');
return this.sseService.register(userId);
return this.sseService.register(userId).pipe(
finalize(() => {
this.sseService.unregister(userId)
})
);
}
}