Refactor SignalR message handling in FruitBankSignalRClient

Update MessageReceived to use SignalReceiveParams and construct
SignalResponseDataMessage with more context. Add AyCode.Core.Serializers
using directive for serializer type support.
This commit is contained in:
Loretta 2026-04-05 09:31:06 +02:00
parent 8f48838ded
commit 27ac2d1843
1 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,7 @@ using Microsoft.AspNetCore.SignalR.Client;
using Nop.Core.Domain.Customers;
using System.Collections.ObjectModel;
using System.ServiceModel.Channels;
using AyCode.Core.Serializers;
using Mango.Nop.Core.Entities;
namespace FruitBankHybrid.Shared.Services.SignalRs
@ -42,10 +43,14 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
/// </summary>
public event Func<int, SignalResponseDataMessage?, Task> OnMessageReceived = null!;
protected override async Task MessageReceived(int messageTag, byte[] messageBytes)
protected override async Task MessageReceived(int messageTag, SignalReceiveParams receiveParams, byte[] data)
{
var responseDataMessage = messageBytes.BinaryTo<SignalResponseDataMessage>();
var responseDataMessage = new SignalResponseDataMessage
{
Status = receiveParams.Status,
DataSerializerType = AcSerializerType.Binary,
ResponseData = data
};
await OnMessageReceived(messageTag, responseDataMessage);
}