games_app/backend/src/controllers/presenceController.ts
2026-06-29 15:01:23 +02:00

11 lines
431 B
TypeScript

import { Response } from 'express';
import { touchAppPresence } from '../realtime/redis/onlinePresence';
import type { AuthRequest } from '../middleware/auth';
/** Lightweight heartbeat so idle browsers stay in the app presence set. */
export async function pingPresence(req: AuthRequest, res: Response): Promise<void> {
const userId = req.user?.userId;
if (userId) await touchAppPresence(userId);
res.json({ ok: true });
}