Spaces:
Runtime error
Runtime error
Download socket/socketServer.js from faridaqurr/tinfo-web-server: direct link, hf CLI and curl.
- Browser
- Download file 472 Bytes
-
https://huggingface.co/spaces/faridaqurr/tinfo-web-server/resolve/main/socket/socketServer.js
- Command line
-
hf download hf://spaces/faridaqurr/tinfo-web-server/socket/socketServer.js
-
curl -L -o socketServer.js https://huggingface.co/spaces/faridaqurr/tinfo-web-server/resolve/main/socket/socketServer.js
472 Bytes
| const { SOCKET_EVENTS } = require("./events"); | |
| let ioInstance = null; | |
| const registerSocketServer = (io) => { | |
| ioInstance = io; | |
| }; | |
| const emitAnnouncementUpdated = (payload = {}) => { | |
| if (!ioInstance) return; | |
| ioInstance.of('/').emit(SOCKET_EVENTS.ANNOUNCEMENT_UPDATED, { | |
| action: payload.action || "updated", | |
| id: payload.id || null, | |
| occurredAt: new Date().toISOString(), | |
| }); | |
| }; | |
| module.exports = { | |
| registerSocketServer, | |
| emitAnnouncementUpdated, | |
| }; | |