// SignalR Test Client - teszteli a SANDBOX kapcsolatot using Microsoft.AspNetCore.SignalR.Client; using System.Text.Json; Console.WriteLine("=== SANDBOX SignalR Test Client ==="); var hubUrl = "http://localhost:59579/fbHub"; Console.WriteLine($"Connecting to: {hubUrl}"); var connection = new HubConnectionBuilder() .WithUrl(hubUrl) .WithAutomaticReconnect() .Build(); connection.On("ReceiveMessage", (tag, data) => { Console.WriteLine($"Received message - Tag: {tag}, Data length: {data?.Length ?? 0}"); }); try { await connection.StartAsync(); Console.WriteLine($"Connected! State: {connection.State}"); // Teszt: GetMeasuringUsers (tag 70) hívása Console.WriteLine("\nTesting GetMeasuringUsers (tag 70)..."); // A SignalR metódus hívása - a szerver "ReceiveMessage" metódusát hívjuk // MessagePack formátumban küldjük az adatot var requestData = new { Tag = 70, Data = Array.Empty() }; await connection.InvokeAsync("ReceiveMessage", 70, Array.Empty()); Console.WriteLine("Message sent! Waiting for response..."); await Task.Delay(3000); Console.WriteLine("\nTest completed!"); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); Console.WriteLine($"Stack: {ex.StackTrace}"); } finally { await connection.StopAsync(); Console.WriteLine("Disconnected."); }