File tree Expand file tree Collapse file tree
monicar-control-center/src/main/java/org/controlcenter/alarm/presentation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .controlcenter .alarm .presentation ;
22
3+ import jakarta .servlet .http .HttpServletResponse ;
4+
35import org .controlcenter .alarm .application .AlarmService ;
46import org .controlcenter .alarm .domain .AlarmStatus ;
57import org .controlcenter .alarm .presentation .dto .AlarmResponse ;
@@ -37,9 +39,12 @@ public class AlarmController implements AlarmApi {
3739
3840 private final AlarmService alarmService ;
3941
40- @ GetMapping (value = "/subscribe" , produces = MediaType . TEXT_EVENT_STREAM_VALUE )
42+ @ GetMapping (value = "/subscribe" )
4143 @ PreAuthorize ("hasRole('ROLE_USER')" )
42- public SseEmitter subscribe (@ AuthenticationPrincipal CustomUserDetails user ) {
44+ public SseEmitter subscribe (
45+ HttpServletResponse response ,
46+ @ AuthenticationPrincipal CustomUserDetails user ) {
47+ response .setHeader ("X-Accel-Buffering" , "no" );
4348 return alarmService .subscribe (user .getId ());
4449 }
4550
Original file line number Diff line number Diff line change 1515
1616import io .swagger .v3 .oas .annotations .Operation ;
1717import io .swagger .v3 .oas .annotations .tags .Tag ;
18+ import jakarta .servlet .http .HttpServletResponse ;
1819import jakarta .validation .Valid ;
1920
2021@ Tag (name = "실시간 알람 API" , description = "실시간 알람 API" )
2122public interface AlarmApi {
2223 @ Operation (summary = "SSE 구독" , description = "SSE 구독" )
23- SseEmitter subscribe (@ AuthenticationPrincipal CustomUserDetails user );
24+ SseEmitter subscribe (
25+ HttpServletResponse response , @ AuthenticationPrincipal CustomUserDetails user );
2426
2527 @ Operation (summary = "알람 승인 API" , description = "점검 필요 -> 점검 예정 -> 점검 진행 -> 점검 완료로 순차적으로 상태 변경" )
2628 void next (
You can’t perform that action at this time.
0 commit comments