我似乎无法通过 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
});