我正在尝试使用一个在线渠道来查看用户来来去去。为此,如文档所建议,我编写了此代码。我收到了。
但是我如何获得“加入”用户的console.log?如果我以其他用户身份登录,则只会获得一个用户凭据。我想它应该是一个数组...那么我该怎么做才能触发“加入”功能?
Echo.join('chat')
.here((users) => {
console.log('hello',users)
this.users = users;
})
.joining((user) => {
console.log('hey you', user)
this.users.push(user);
})
.leaving((user) => {
this.users.splice(this.users.indexOf(user), 1);
})