16 lines
558 B
JavaScript
16 lines
558 B
JavaScript
// const { WebSocketServer } = require("ws");
|
|
//
|
|
// const wss = new WebSocketServer({ port: 8080 });
|
|
//
|
|
// wss.on('connection', function connection(ws) {
|
|
// console.log("客户端连接建立成功: ")
|
|
// ws.on('message', function message(data) {
|
|
// console.log("收到客户端发送的消息")
|
|
// wss.clients.forEach(function each(client) {
|
|
// // 排除我自己 和 掉线的客户端
|
|
// if (client !== ws) {
|
|
// client.send(data.toString());
|
|
// }
|
|
// });
|
|
// });
|
|
// });
|