Friday, March 3, 2017

Laravel Echo joining private channel `.here()`

I have a join to a private channel:

Echo.private('chat_room.'+comments_room_id)
.listen('.App.Events.Common.Comment.CommentCreated', function(e) {
                    e.comment.user = e.user;
                    e.comment.new_msg = 1;
                    _this.comment_room.comments.unshift(e.comment);
                });

I would like to use the .here() presence call to keep a array of users updated with who is currently online.

I tried the following:

Echo.private('chat_room.'+comments_room_id)
                    .here(users => {
                        this.users = users;
                    })
                    .listen('.App.Events.Common.Comment.CommentCreated', function(e) {

But that did not work...

Error in console is: Echo.private(...).here is not a function



via Andrew

Advertisement