Event not being triggered by Pusher.
See original GitHub issueHi,
I think the event listener for private channels is not functioning correctly. I have followed the documentation so far, but Pusher is not triggering the event listener. In pusher under the debug console, I can see that the data is present, which can be seen in the attached image.
I also am posting below the code the I am using, in case the mistake is on my side (which I don’t hope).
<?php
namespace App\Events\Chat;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class UserSendChatMessage implements ShouldBroadcast
{
use SerializesModels, InteractsWithSockets;
public $id;
/**
* UserSendChatMessage constructor.
* @param $user
* @param $message
*/
public function __construct($id)
{
$this->id = $id
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel("conversation.{$this->id}");
}
}
Echo.private('conversation.' + this.uniqueConversationId)
.listen('.App.Events.Chat.UserSendChatMessage', function (event) {
alert('here...');
console.log(event);
});
Broadcast::channel('conversation.*', function ($user, $uniqueId) {
// Security: not secure, yet.
return true;
});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Pusher App events not triggering - php - Stack Overflow
If the events aren't reaching Pusher, make sure the Pusher server time and your server time match or are within 599s of each...
Read more >Pusher not triggering events form client side. #516 - GitHub
I just opened my app today to have a look. Tried few pusher calls but suddenly not working getting response error.
Read more >PHP Pusher event was not being triggered - Muhammad Habib
Problem: I have installed php pusher using composer require pusher/pusher-php-server and i was testing pusher library to send live event but ...
Read more >Pusher Channels Docs | What is an event?
The event is triggered either when the authorization endpoint returns a HTTP status code that is not 200 or if there is a...
Read more >Publish Pusher events for new emails - Zapier
Within Pusher this is often referred to as "triggering an event" where you trigger an event on a channel. But this terminology is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing this issue because it’s already solved, old or not relevant anymore. Feel free to reply if you’re still experiencing this issue.
For me a dive into how
listen
differs fromon
provided the solution, it will first pass the event through the event formatter, which will add a namespace. https://github.com/laravel/echo/blob/master/src/channel/pusher-channel.ts#L89