using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR.Client;
namespace SignalRConsoleTest
static async Task Main(string[] args)
var hubUrl = "https://ompstaging.service.signalr.net/client/?hub=MerchantCashierNotification";
var connection = new HubConnectionBuilder()
.WithUrl(hubUrl, options =>
options.AccessTokenProvider = () => Task.FromResult("PK3X2OO1W60yEOmw1qR9hphvrydcB7peb1Ix/rq9dyE=");
connection.Closed += async (error) =>
Console.WriteLine("Connection closed. Attempting to reconnect...");
await Task.Delay(new Random().Next(0, 5000));
await connection.StartAsync();
await connection.StartAsync();
Console.WriteLine("Connection started successfully.");
Console.WriteLine("Press Enter to exit...");
Console.WriteLine($"Error connecting: {ex.Message}");
await connection.StopAsync();
Console.WriteLine("Connection stopped.");