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()); } }); }); });