Laravel WebSockets在推送程序中无法连接 [英] Laravel websockets failed to connect in pusher
问题描述
运行项目时,出现异常错误,但没有明确的消息.我只有这种主体错误
When I run my project, I got an exception error but it does not have a clear message. I only have this kind of the main body error
我可以通过 http://127.0.0.1:8000/laravel-websockets
访问websocket管理页面,但是当我进入 http://127.0.0.1:8000/
我在下面遇到错误.
I can access websocket admin page at http://127.0.0.1:8000/laravel-websockets
but when i go http://127.0.0.1:8000/
i got errors below.
The following error was encountered while trying to retrieve the URL: http://127.0.0.1:6001/apps/995591/events?
Connection to 127.0.0.1 failed.
The system returned: (111) Connection refused
The remote host or network may be down. Please try the request again.
Generated Tue, 05 May 2020 17:12:03 GMT by proxyserversetup-s-1vcpu-1gb-sgp1-07 (squid/3.5.27)
我遵循此链接
这是我的一些配置
broadcasting.php
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' => false,
'useTLS' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'http',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
],
],
],
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=inventory
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=995591
PUSHER_APP_KEY=644a4ac1988060882370
PUSHER_APP_SECRET=739696537f4fb23b8fcd
PUSHER_APP_CLUSTER=ap1
我正在使用laravel 6.x和laravel Websockets的当前版本.
I am using laravel 6.x and the current version for laravel websockets.
是我的ISP导致错误吗?
Is it my ISP cause the error?
推荐答案
我遇到了类似的事情.
如果您使用的是 localhost
,请更改
If you are using localhost
, change
'useTLS' => true,
为假
'useTLS' => false,
它应该在您的broadcast.php文件中
It should be in your broadcasting.php file
'connections' => [
'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'),
'useTLS' => false,
],
],
....
这篇关于Laravel WebSockets在推送程序中无法连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!