[Vuejs]-How to force reload a page to make POST request pass

1👍

Thank you for posting your code. It looks like we can rule out the PHP angle I mentioned in the comment above. I think the problem is that you aren’t listening for new users.

# Joining Presence Channels
https://laravel.com/docs/5.8/broadcasting#joining-presence-channels

The here callback will be executed immediately once the channel is joined successfully, and will receive an array containing the user information for all of the other users currently subscribed to the channel.

To me, this indicates that the here method only fires once when your application joins the channel. In order to receive new users, you will need to subscribe to additional events and push a new user to (or delete a user from) the users array as received.

window.Echo.join('online')
    .here((users) => {
        // loads the initial data
        this.users = users;
    })
    .joining((user) => {
        // push a newly joining user to the users array
        // ...
    })
    .leaving((user) => {
        // delete a user who is leaving from the users array
        // ...
    });

I didn’t write any specific code for the additional methods since you may want to sort users in a particular way, but I think you should get the idea.

Leave a comment