11 lines
431 B
TypeScript
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 });
|
|
}
|