摘要: //服务端 let io = require('socket.io')();let userList = [ { name: "用户1", age: "18", id: "00000001" }, { name: "用户2", age: "18", id: "00000002" }, { name: 阅读全文
posted @ 2021-03-27 17:30 莣ㄋ噯 阅读(137) 评论(0) 推荐(0)
摘要: //服务端let io = require('socket.io')();io.sockets.on('connection', socket => { //初始化之后通过join加入room1房间 socket.join("room1", function () { console.log("Jo 阅读全文
posted @ 2021-03-27 16:48 莣ㄋ噯 阅读(306) 评论(0) 推荐(0)
摘要: const io = require('socket.io')({cors:true});//{cors:true}处理跨域io.on('connection', client => { client.on('event', data => { console.log(data); }); setT 阅读全文
posted @ 2021-03-27 14:59 莣ㄋ噯 阅读(580) 评论(0) 推荐(0)