feat: improve websocket server shutdown process and enhance codec preset handling

This commit is contained in:
Neil Dorin 2026-04-06 11:25:30 -06:00
parent 5b45a5caa6
commit 30979f2b67
3 changed files with 21 additions and 3 deletions

View file

@ -211,6 +211,14 @@ namespace PepperDash.Core
public void StopServer()
{
Debug.Console(0, "Stopping Websocket Server");
_httpsServer.WebSocketServices[_path].Sessions.Broadcast("Server is stopping");
foreach (var session in _httpsServer.WebSocketServices[_path].Sessions.Sessions)
{
session.Context.WebSocket.Close(1001, "Server is stopping" );
}
_httpsServer?.Stop();
_httpsServer = null;

View file

@ -90,7 +90,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
/// <param name="context"></param>
protected override void HandlePost(HttpCwsContext context)
{
Debug.WebsocketSink.StopServer();
Task.Run(() => Debug.WebsocketSink.StopServer());
context.Response.StatusCode = 200;
context.Response.StatusDescription = "OK";
@ -98,6 +99,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
Debug.LogMessage(LogEventLevel.Information, "Websocket Debug Session Stopped");
}
}
}

View file

@ -922,8 +922,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
if (presetsCodec != null && Codec is IHasFarEndCameraControl &&
(Codec as IHasFarEndCameraControl).ControllingFarEndCameraFeedback.BoolValue)
{
currentPresets = presetsCodec.FarEndRoomPresets;
else if (presetsCodec != null) currentPresets = presetsCodec.NearEndPresets;
}
else if (presetsCodec != null)
{
currentPresets = presetsCodec.NearEndPresets;
}
if (currentPresets == null)
{
return new List<CodecRoomPreset>();
}
return currentPresets;
}