feat: add queued run namespace
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user