我想制作类似https://images.ctfassets.net/1es3ne0caaid/4EFIbGRt8koGQkKISWuK4A/731bf37c6b0abf6d7319f54907ee6f09/how-to-create-web-notifications-using-laravel-and-pusher.gif的东西,我已经找到并搜索了解决方案,但没有任何解决方案,请帮忙。
我正在使用laravel 5.5和php 7.0.15版本
我遇到错误
推杆:错误: {“ type”:“ WebSocketError”,“ error”:{“ type”:“ PusherError”,“ data”:{“ code”:4001,“ message”:“ App 密钥PUSHER_API_KEY不在此群集中。您是否忘记指定 集群?“}}}
我已经设置了.env文件
PUSHER_APP_ID=****88
BROADCAST_DRIVER=pusher
PUSHER_APP_KEY=*********f29cf5f48aa
PUSHER_APP_SECRET=**********e7ce9cd57d
PUSHER_APP_CLUSTER=ap2
这是我的config / broadcasting.php文件
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true, //for local 'encrypted' => false
],
],
我在本地工作,并更改了 encrypted => false ,但这里没有发生任何事情,这是我的composer.json文件
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"nesbot/carbon": "^1.34",
"orangehill/iseed": "dev-master",
"pusher/pusher-php-server": "^3.2"
},