Laravel Webpush无法在实时服务器上运行

时间:2019-05-14 11:16:37

标签: php laravel laravel-5 web-push

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');
    }

}

客户端错误:

  

POST https://updates.push.services.mozilla.com/wpush/v2/gAAAAABc2TG4-O_htPgOvUt8SVtdxN4BbnfB2aK0KC8gZ2FZYYRuGNZWbmNakEb1KMjsI-FDLtaobNk7-NE9Zr8ftaveMNtG8w7US5cjAmqW35QjMfjMiosoy96EWJpvaIzxbnQZ8zLA3PSICZHWMjfsqhbkFl71Ib7kTyOCKPLeTdPB8hV6iT8

产生401 Unauthorized

0 个答案:

没有答案