const WebSocketServer = require('ws').Server;
const wss =new WebSocketServer({
ip: "127.0.0.1",
port:4000
})
wss.on('connection', (ws)=>{
ws.on('message',(message) => {
ws.send(message)
})
})
require("net").createServer(con =>{
con.on('data',(data)=>{
})
}).listen(3000)
var client = require("net").connect('3000','127.0.0.1');
client.on('data',(message)=>{
client.write(message);
})
require('http').createServer((req,res)=>{
console.log(req.headers);
res.setHeader('Content-Type',"text/html");
res.end(req.url);
}).listen(4000);
require('http').request({
host: '127.0.0.1',
url: '/',
},(res)=>{
res.on('data',(data)=>{
console.log(data);
})
res.on('end',()=>{
console.log("End");
})
}).end();