When setting up the connection.
_connection = new HubConnectionBuilder()
.WithUrl($"{AppSettingsHelper.Get("SignalRUrl")}/genericSocketHub")
.AddJsonProtocol(options =>
{
options.PayloadSerializerSettings.ContractResolver = new DefaultContractResolver();
})
.Build();
_connection.Closed += ConnectionClosed;
await _connection.StartAsync();
However it seems like the closed only gets called when theres a timeout and it closes, a standard STATE change from Connected to Disconnected doesnt trigger that method.
Is there another way to detect it? Or, why is my connecting changing to Disconnected?
FYI. I'm creating the class that holds the connection as a Singleton and would like to always keep the connection open.