Skip to content

Commit 6f925ed

Browse files
committed
2 parents 079bc0b + e58bd65 commit 6f925ed

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

backend/src/api/routes/apiKeys.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ router.delete('/:keyId', authorize('bot:update'), async (req, res) => {
163163
const botId = parseInt(req.params.botId, 10);
164164
const keyId = parseInt(req.params.keyId, 10);
165165

166+
const { getIO } = require('../../real-time/socketHandler');
167+
168+
const io = getIO();
169+
170+
io.of("/bot-api")
171+
.in(`key_${keyId}`)
172+
.disconnectSockets(true)
173+
166174
const result = await prisma.botApiKey.deleteMany({
167175
where: { id: keyId, botId },
168176
});

backend/src/real-time/botApi/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function initializeBotApiNamespace(io) {
1616
console.log(`[Bot API] Клиент подключился к боту ID: ${socket.botId} (ключ: ${socket.keyPrefix})`);
1717

1818
socket.join(`bot_${socket.botId}`);
19-
19+
socket.join(`key_${socket.keyId}`);
2020

2121
const isOnline = botManager.isBotRunning(socket.botId);
2222
socket.emit('bot:status', { online: isOnline });

0 commit comments

Comments
 (0)