Laravel网络插座在推进器中无法连接



当我运行我的项目时,我得到了一个异常错误,但它没有明确的消息。我只有这种主体错误

我可以访问http://127.0.0.1:8000/laravel-websockets的websocket管理页面,但当我访问http://127.0.0.1:8000/时,我在下面遇到了错误。

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

'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。

是我的ISP造成的错误吗?

我遇到了类似的事情。

如果您正在使用localhost,请更改

'useTLS' => true,

错误

'useTLS' => false,

它应该在broadcasting.php文件中

'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,
],
],
....

确保将scheme设置为https并使用"useTLS"=>true,然后设置curl_options,如下所示,如果您设置SSL证书的路径&私钥。

'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
],

验证.env文件中的PUSHER_PORT数据:

PUSHER_HOST=127.0.0.1
PUSHER_PORT=6379

使用docroot中的CLI和web套接字的artisan命令进行验证:

php artisan websockets:serve --port=6379

相关内容

  • 没有找到相关文章

最新更新