Laravel没有派Pusher

时间:2017-09-08 09:29:30

标签: laravel pusher

所以我正在与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;不幸的是..

2 个答案:

答案 0 :(得分:0)

尝试启用内置p usher client logging system

答案 1 :(得分:0)

检查您的本地apache / nginx日志中是否显示“无法获取本地isuer证书”的消息。

如果是这样,请在您的PHP配置中定义curl.cainfo的路径。

可以下载文件here