From 9bed394d1140e8ce4cda5f93818420a299f48357 Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:10:15 +0200 Subject: [PATCH] Send initial event after opening an SSE connection (#719) --- SseServer/src/SseServer/Controllers/SseController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SseServer/src/SseServer/Controllers/SseController.cs b/SseServer/src/SseServer/Controllers/SseController.cs index f8a5a5d927..569a06bbb6 100644 --- a/SseServer/src/SseServer/Controllers/SseController.cs +++ b/SseServer/src/SseServer/Controllers/SseController.cs @@ -47,6 +47,8 @@ await _mediator.Send(new UpdateDeviceRegistrationCommand { _eventQueue.Register(address); + await streamWriter.SendServerSentEvent("ConnectionOpened"); + await foreach (var eventName in _eventQueue.DequeueFor(address, HttpContext.RequestAborted)) { await streamWriter.SendServerSentEvent(eventName);