所以我正在与Laravel建立推动力,我无法发送信息。它们不会在推送器调试控制台中收到,因此错误必须在发送时发生。以下是您可能需要的任何信息,以帮助我发现错误,因为我花了几个小时试图解决它,现在无法再进一步了。
我的.env文件中的相关信息:
BROADCAST_DRIVER=pusher
QUEUE_DRIVER=sync
PUSHER_APP_ID=iscorrect
PUSHER_APP_KEY=iscorrect
PUSHER_APP_SECRET=iscorrect
我的broadcast.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!";
});
访问/推送时我没有遇到任何错误,但是我的Pusher Debug控制台正在等待事件&#34;不幸的是..