Download server.js from NOXBALL/oyun: direct link, hf CLI and curl.
- Browser
- Download file 599 Bytes
-
https://huggingface.co/spaces/NOXBALL/oyun/resolve/main/server.js
- Command line
-
hf download hf://spaces/NOXBALL/oyun/server.js
-
curl -L -o server.js https://huggingface.co/spaces/NOXBALL/oyun/resolve/main/server.js
599 Bytes
| const express = require('express'); | |
| const { WebSocketServer } = require('ws'); | |
| const path = require('path'); | |
| const app = express(); | |
| const PORT = 7860; | |
| app.use(express.static(path.join(__dirname, 'public'))); | |
| const server = app.listen(PORT, () => { | |
| console.log('Oyun sunucusu hazır!'); | |
| }); | |
| const wss = new WebSocketServer({ server }); | |
| wss.on('connection', (ws) => { | |
| ws.on('message', (data) => { | |
| wss.clients.forEach((client) => { | |
| if (client !== ws && client.readyState === ws.OPEN) { | |
| client.send(data.toString()); | |
| } | |
| }); | |
| }); | |
| }); |