nodejs status check

This commit is contained in:
Thanakorn S
2026-05-27 11:18:09 +07:00
parent 418dbf9ba6
commit 5221b3a1a1
+10
View File
@@ -34,6 +34,16 @@ app.post('/emit', (req, res) => {
res.json({ ok: true });
});
// ── /health ───────────────────────────────────────────────────────────────────
app.get('/health', (req, res) => {
res.json({
status: 'ok',
uptime: Math.floor(process.uptime()),
connections: io.engine.clientsCount,
memory_mb: Math.round(process.memoryUsage().rss / 1024 / 1024 * 10) / 10
});
});
// ── WebSocket connections ─────────────────────────────────────────────────────
// Each browser tab connects here on page load.
// It joins a room named company_<id> so events stay isolated per company.