Laravel 5.3:Larevel Echo - 无法通过Pusher检索通知广播

时间:2017-01-25 07:44:44

标签: javascript php laravel-5.3 pusher laravel-echo

我似乎无法通过Pusher检索通知广播

Pusher配置(config / broadcasting.php)

'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_KEY'),
        'secret' => env('PUSHER_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => 'ap1',
            'encrypted' => true
        ],
    ],

我如何发送*通知(测试两种​​方法):(SomeController.php)

// User::find(7)->notify(new OrderProcess());
Notification::send(User::find(7), new OrderProcess());

[问题] 我如何检索通知:(app.js),是的,已经尝试过 bootstrap.js

    import Echo from "laravel-echo"

    window.Echo = new Echo({
        broadcaster: 'pusher',
        key: 'some_key',
        cluster: 'ap1'
    });

    var test = window.Echo.private('App.User.7')
    .notification((notification) => {
        console.log(notification.type); // this never come up
    });

0 个答案:

没有答案