function onConnect() { let user = this.user; // 为什么不是undefined let msg = createMessage('join', user, ${user.name} joined.); this.wss.broadcast(msg); // build user list: let users = this.wss.clients.map(function (client) { return client.user; }); this.send(createMessage('list', user, users)); }
${user.name} joined.
Sign in to make a reply
谢嘉欣是我呀
function onConnect() { let user = this.user; // 为什么不是undefined let msg = createMessage('join', user,
${user.name} joined.
); this.wss.broadcast(msg); // build user list: let users = this.wss.clients.map(function (client) { return client.user; }); this.send(createMessage('list', user, users)); }