Laravel webpush在实时服务器上不起作用。它正在localhost上运行。
具有php 7.1的Linux基本实时服务器
class PushDemo extends Notification
{
use Queueable;
private $push_arr;
public function __construct($arr){
//exit('==2');
$this->push_arr = $arr;
}
public function via($notifiable)
{
return [WebPushChannel::class];
}
public function toWebPush($notifiable, $notification)
{
return (new WebPushMessage)
->title($this->push_arr['title'])
->icon('/site_images/1556623062.30.png')
->body($this->push_arr['body'])
->action('View App', 'notification_action');
}
}
客户端错误:
产生401 Unauthorized