feat: add queued run namespace

This commit is contained in:
Rohit
2025-08-14 15:57:01 +05:30
parent ebfc6014c6
commit 7ae134dc4e

View File

@@ -162,6 +162,22 @@ 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();
}
});
server.listen(SERVER_PORT, '0.0.0.0', async () => {
try {
await connectDB();