0
因此,我设置与Laravel的推进器,我无法让它发送消息。它们在推送器调试控制台中没有收到,所以在发送它们时必须是错误的。以下是您可能需要的任何信息,以帮助我发现错误,因为我花了几个小时试图修复它,现在无法继续。Laravel不发送推送
从我.ENV文件的相关信息:
BROADCAST_DRIVER=pusher
QUEUE_DRIVER=sync
PUSHER_APP_ID=iscorrect
PUSHER_APP_KEY=iscorrect
PUSHER_APP_SECRET=iscorrect
我broadcasting.php
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => 'eu',
'encrypted'=>true
],
],
应该解雇消息
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class HelloPusherEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Only (!) Public members will be serialized to JSON and sent to Pusher
**/
public $message;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the channels the event should be broadcast on.
*
* @return array
*/
public function broadcastOn()
{
return ['my-channel'];
}
}
最后我的路线事件应该触发事件:
Route::get('/pusher', function() {
event(new App\Events\HelloPusherEvent('Hi there Pusher!'));
return "Event has been sent!";
});
我没有得到任何错误来访时/推杆,但是我的推杆调试控制台“等待事件”不幸..
当我跟随我得到 ReflectionException(-1) “班级推送者不存在” 打开我的网站的任何页面。 – Rufrage
当我现在作曲家更新时,也会发生这种情况。它给了我相同的ReflectionException。但是,当我反转变化时,考虑调用页面或更新作曲家,所有事情都会重新开始。任何想法为什么? – Rufrage