Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Web / PUSG.Web / Hubs / HomeHub.cs
diff options
context:
space:
mode:
Commit1489a24d74985ef9e51fd9976fc580857062011c (patch)
Author
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-02-28 14:22:18 +0200
Committer
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-02-28 14:22:18 +0200
Filesd98fea7203c6dfabad2c692b1c9848e94fd69e76 /src/Web/PUSG.Web/Hubs/HomeHub.cs
pusg-api-main.tar
pusg-api-main.tar.gz
pusg-api-main.zip
Parent5bd0777227894df6204cd8e52d19f019f296e910 (diff)
Added Event Service HEAD main
* Major Refactoring to Services (moved to correct namespace) * Fixed bug on Disconnect for HomeHub * Fixed bug with multiple notifications of end game (introduced new bug to fix later)
1 files changed, 11 insertions, 5 deletions
-rw-r--r--src/Web/PUSG.Web/Hubs/HomeHub.cs16
diff --git a/src/Web/PUSG.Web/Hubs/HomeHub.cs b/src/Web/PUSG.Web/Hubs/HomeHub.cs
index 06a8d8e..c5e520f 100644
--- a/src/Web/PUSG.Web/Hubs/HomeHub.cs
+++ b/src/Web/PUSG.Web/Hubs/HomeHub.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.SignalR;
-using PUSG.Web.Static;
+using PUSG.Web.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,6 +9,8 @@ namespace PUSG.Web.Hubs
{
public class HomeHub : Hub
{
+ private const string ServerMessageUser = "PUSG";
+
private ISessionService sessionService;
public HomeHub(ISessionService sessionService)
@@ -55,10 +57,14 @@ namespace PUSG.Web.Hubs
public override async Task OnDisconnectedAsync(Exception exception)
{
- string username = this.sessionService.Users[this.Context.ConnectionId];
- this.sessionService.LiveConnections.Remove(this.Context.ConnectionId);
- this.sessionService.RemoveUser(this.Context.ConnectionId);
- await this.BroadcastToLoggedIn("OnLoggedOut", username);
+ if (this.sessionService.IsLogged(this.Context.ConnectionId))
+ {
+ string username = this.sessionService.Users[this.Context.ConnectionId];
+ this.sessionService.LiveConnections.Remove(this.Context.ConnectionId);
+ this.sessionService.RemoveUser(this.Context.ConnectionId);
+ await this.BroadcastToLoggedIn("OnLoggedOut", username);
+ }
+
await base.OnDisconnectedAsync(exception);
}
}