anistream/index.js
ShakedAp cb7fb85842 Added web sockets
Changed index.js to add WebSockets to the server
Changed index.html to add WebSockets to the client
Install ws (web sockets) module
2023-06-24 13:55:54 +03:00

17 lines
471 B
JavaScript

const express = require('express')
const app = express()
const server = require('http').createServer(app);
const WebSocket = require('ws')
const wss = new WebSocket.Server({ server:server });
wss.on('connection', function connection(ws) {
console.log('A new client Connected!');
ws.send('Welcome New Client!');
});
app.get("/", function (req, res) {
res.sendFile(__dirname + "/index.html");
});
server.listen(3000, () => console.log(`Lisening on port :3000`))