LANCommander/LANCommander.Server/Hubs/PlaySession.cs
Pat Hartl ecaecd21bb Send keepalive while game is running
Sends a keepalive/heartbeat signal across RPC while a game is running. Server-side this enables the ability to manage play session state with realtime information instead of hoping that the client will stop the play session. Keepalives are tracked in server cache allowing for future potential horizontally-scaled server instances.
2026-06-14 00:53:45 -05:00

17 lines
443 B
C#

namespace LANCommander.Server.Hubs;
public partial class RpcHub
{
public async Task GameKeepAliveAsync(Guid gameId)
{
try
{
if (Guid.TryParse(Context.UserIdentifier, out var userId))
await keepAliveTracker.TouchAsync(gameId, userId);
}
catch (Exception ex)
{
logger.LogError(ex, "Failed to record keepalive for game {GameId}", gameId);
}
}
}