John Davidson

php - Laravel Echo PresenceChannel vs listen events doesn't work

0 comments
Message:


Good time, for the implementation of the chat room, I have done all the Pusher configurations correctly, and sending messages and displaying online users works correctly, but the event in the .listen method does not work, and it does not even log. Thank you for your help. I have been dealing with this problem for a long time. I hit


this is my event


and in echo.js
My problem is in the .listen section, where the event is not executed


this is channels.php
channels.php


and this messagecontroller



My Answer:
In Laravel Echo, a PresenceChannel is a type of channel that allows you to subscribe to presence channel events, such as when a user joins or leaves a channel. Presence channels are useful for building real-time collaborative applications where you need to track the presence of multiple users in a channel.

On the other hand, listen events are used to listen for custom events that are broadcasted from the server to the client. These events can be triggered by any action on the server, such as creating a new post or updating a user profile.

In summary, PresenceChannel is specifically designed for tracking the presence of users in a channel, while listen events are more general and can be used to listen for any custom events broadcasted from the server. Both can be useful in different scenarios depending on the requirements of your application.

Rate this post

3 of 5 based on 9106 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us