Merge pull request #736 from RohitR311/client-notifs

feat: enable client-side notifications for all runs
This commit is contained in:
Karishma Shukla
2025-08-25 19:33:14 +05:30
committed by GitHub
3 changed files with 116 additions and 45 deletions

View File

@@ -160,10 +160,27 @@ app.use((req, res, next) => {
next();
});
io.of('/queued-run').on('connection', (socket) => {
const userId = socket.handshake.query.userId as string;
if (userId) {
socket.join(`user-${userId}`);
logger.log('info', `Client joined queued-run namespace for user: ${userId}, socket: ${socket.id}`);
socket.on('disconnect', () => {
logger.log('info', `Client disconnected from queued-run namespace: ${socket.id}`);
});
} else {
logger.log('warn', `Client connected to queued-run namespace without userId: ${socket.id}`);
socket.disconnect();
}
});
setInterval(() => {
processQueuedRuns();
}, 5000);
server.listen(SERVER_PORT, '0.0.0.0', async () => {
try {
await connectDB();