Spaces:
Running
Running
Download socket/kick.js from 4send/messenger: direct link, hf CLI and curl.
- Browser
- Download file 464 Bytes
-
https://huggingface.co/spaces/4send/messenger/resolve/main/socket/kick.js
- Command line
-
hf download hf://spaces/4send/messenger/socket/kick.js
-
curl -L -o kick.js https://huggingface.co/spaces/4send/messenger/resolve/main/socket/kick.js
464 Bytes
| const { getIO } = require('./io'); | |
| const kickSessions = (username, predicate) => { | |
| const io = getIO(); | |
| if (!io || !username) return; | |
| for (const [, s] of io.sockets.sockets) { | |
| if (s.username !== username) continue; | |
| if (predicate && !predicate(s.authToken)) continue; | |
| try { s.emit('session_revoked'); } catch {} | |
| setTimeout(() => { try { s.disconnect(true); } catch {} }, 50); | |
| } | |
| }; | |
| module.exports = { kickSessions }; | |