From f06bd5004dd502d9950fafc7ee62d73a7388b409 Mon Sep 17 00:00:00 2001 From: Loretta Date: Sun, 5 Apr 2026 00:30:05 +0200 Subject: [PATCH] Remove client-to-server streaming support in SignalR client Removed OnReceiveStreamMessage from both AcSignalRClientBase and IAcSignalRHubBase, eliminating client-to-server streaming support. Updated StreamAsync calls to use the explicit method name string. This change enforces server-to-client streaming only and cleans up related interface and method references. --- AyCode.Services/SignalRs/AcSignalRClientBase.cs | 9 ++------- AyCode.Services/SignalRs/IAcSignalRHubBase.cs | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/AyCode.Services/SignalRs/AcSignalRClientBase.cs b/AyCode.Services/SignalRs/AcSignalRClientBase.cs index 159dd9c..4a298de 100644 --- a/AyCode.Services/SignalRs/AcSignalRClientBase.cs +++ b/AyCode.Services/SignalRs/AcSignalRClientBase.cs @@ -79,11 +79,6 @@ namespace AyCode.Services.SignalRs HubConnection = null; } - public virtual IAsyncEnumerable OnReceiveStreamMessage(int messageTag, byte[]? messageBytes) - { - throw new NotSupportedException("Client does not support serving streams to the server. Streams are established Server-to-Client only."); - } - private Task HubConnection_Closed(Exception? arg) { if (_responseByRequestId.IsEmpty) Logger.DebugConditional("Client HubConnection_Closed"); @@ -216,7 +211,7 @@ namespace AyCode.Services.SignalRs var msgBytes = message != null ? SignalRSerializationHelper.SerializeToBinary(message) : null; var stream = HubConnection.StreamAsync( - nameof(IAcSignalRHubBase.OnReceiveStreamMessage), + "OnReceiveStreamMessage", messageTag, msgBytes, cancellationToken); @@ -289,7 +284,7 @@ namespace AyCode.Services.SignalRs var msgBytes = SignalRSerializationHelper.SerializeToBinary(message); var stream = HubConnection.StreamAsync( - nameof(IAcSignalRHubBase.OnReceiveStreamMessage), + "OnReceiveStreamMessage", messageTag, msgBytes, cancellationToken); diff --git a/AyCode.Services/SignalRs/IAcSignalRHubBase.cs b/AyCode.Services/SignalRs/IAcSignalRHubBase.cs index e5c4fa9..7ec6f9c 100644 --- a/AyCode.Services/SignalRs/IAcSignalRHubBase.cs +++ b/AyCode.Services/SignalRs/IAcSignalRHubBase.cs @@ -4,6 +4,4 @@ public interface IAcSignalRHubBase { //Task OnRequestMessage(int messageTag, int requestId); Task OnReceiveMessage(int messageTag, byte[] messageBytes, int? requestId); - - IAsyncEnumerable OnReceiveStreamMessage(int messageTag, byte[]? messageBytes); } \ No newline at end of file