Replace custom socket implementation with SignalR.
Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework Also some UI redesign to accommodate different login experience.
This commit is contained in:
21
Shogi.Api/Application/GameHubContext.cs
Normal file
21
Shogi.Api/Application/GameHubContext.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Shogi.Api.Application;
|
||||
|
||||
/// <summary>
|
||||
/// Used to send signals to connected clients.
|
||||
/// </summary>
|
||||
public class GameHubContext(IHubContext<GameHub> context)
|
||||
{
|
||||
public async Task Emit_SessionJoined(string sessionId)
|
||||
{
|
||||
var clients = context.Clients.Group(sessionId);
|
||||
await clients.SendAsync("SessionJoined");
|
||||
}
|
||||
|
||||
public async Task Emit_PieceMoved(string sessionId)
|
||||
{
|
||||
var clients = context.Clients.Group(sessionId);
|
||||
await clients.SendAsync("PieceMoved");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user