Files
ClassContent/历届学生/front-end-team/项目练习/上课项目/聊天室/backend/demo.js
2024-09-27 02:06:13 +08:00

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