mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
feat: SSE push for worklist updates — instant missed-call notifications
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
New worklist SSE stream replaces the 30s frontend poll. When the
missed-call webhook creates a Call record, it emits a worklist-updated
event via the supervisor's worklistSubject. All connected agents
receive the event immediately.
- supervisor.service.ts: worklistSubject + emitWorklistUpdate()
- supervisor.controller.ts: @Sse('worklist/stream') broadcast endpoint
- missed-call-webhook.controller.ts: emits after createCall() with
callerPhone + callerName for toast notification
- worklist.module.ts: imports SupervisorModule (forwardRef)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,4 +52,18 @@ export class SupervisorController {
|
||||
} as MessageEvent)),
|
||||
);
|
||||
}
|
||||
|
||||
// Worklist SSE — broadcast to all connected agents. When a missed
|
||||
// call is created by the webhook, this fires immediately so agents
|
||||
// don't wait for the 30s worklist poll. The payload includes the
|
||||
// caller's phone + name for a toast notification.
|
||||
@Sse('worklist/stream')
|
||||
streamWorklistUpdates(): Observable<MessageEvent> {
|
||||
this.logger.log('[SSE] Worklist stream opened');
|
||||
return this.supervisor.worklistSubject.pipe(
|
||||
map(event => ({
|
||||
data: JSON.stringify(event),
|
||||
} as MessageEvent)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user