我在我的项目中使用了Pusher。我按照Laravel文档的要求配置了广播。当我触发事件时,Pusher并没有为我工作。但是当我从Pusher控制台发送数据时,Pusher会接收到这些数据。
我还尝试了vinkla/pusher。它可以正常工作,但是Laravel事件广播无法工作。
请帮助我。
这里是我的TestEvent.php
代码:
namespace Factum\Events;
use Factum\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class TestEvent implements ShouldBroadcast
{
use SerializesModels;
public $text;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($text)
{
$this->text = $text;
}
/**
* Get the channels the event should be broadcast on.
*
* @return array
*/
public function broadcastOn()
{
return ['test-channel'];
}
}