From edffb7dfeb98d4285a39c16ad54f252a5c73b239 Mon Sep 17 00:00:00 2001 From: Macocian Alexandru Victor Date: Mon, 27 Nov 2023 00:36:53 +0100 Subject: [PATCH] Uniformize LiveFeed responses (#30) --- GuildWarsPartySearch/Services/Feed/LiveFeedService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GuildWarsPartySearch/Services/Feed/LiveFeedService.cs b/GuildWarsPartySearch/Services/Feed/LiveFeedService.cs index cb0229e..10c57c7 100644 --- a/GuildWarsPartySearch/Services/Feed/LiveFeedService.cs +++ b/GuildWarsPartySearch/Services/Feed/LiveFeedService.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using GuildWarsPartySearch.Server.Models.Endpoints; +using Newtonsoft.Json; using System.Core.Extensions; using System.Net.WebSockets; using System.Text; @@ -24,7 +25,8 @@ public void AddClient(WebSocket client) public async Task PushUpdate(Models.PartySearch partySearchUpdate, CancellationToken cancellationToken) { - var payloadString = JsonConvert.SerializeObject(partySearchUpdate); + // Since LiveFeed endpoint expects a PartySearchList, so we send a PartySearchList with only the update to keep it consistent + var payloadString = JsonConvert.SerializeObject(new PartySearchList { Searches = [ partySearchUpdate ] }); var payload = Encoding.UTF8.GetBytes(payloadString); await ExecuteOnClientsInternal(async client => {