mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 17:57:21 +01:00
add events
This commit is contained in:
parent
532d88ed4c
commit
01ac0e476b
12 changed files with 448 additions and 3 deletions
|
|
@ -135,6 +135,8 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||
|
||||
Logger.LogInformation("Recreating Connection");
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_connectionCancellationTokenSource.Cancel();
|
||||
_connectionCancellationTokenSource = new CancellationTokenSource();
|
||||
|
|
@ -419,6 +421,9 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||
_healthCheckTokenSource?.Cancel();
|
||||
ServerState = ServerState.Reconnecting;
|
||||
Logger.LogWarning(arg, "Connection closed... Reconnecting");
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Warning,
|
||||
$"Connection interrupted, reconnecting to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshToken(CancellationToken ct)
|
||||
|
|
@ -464,6 +469,9 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||
|
||||
if (_mareHub is not null)
|
||||
{
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Stopping existing connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_initialized = false;
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
Mediator.Publish(new DisconnectedMessage());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue