0

我有服务器,我从子目录(如https://laravel-apps.test/app1 )提供 Laravel 应用程序。它抛出这个错误WebSocket connection to 'wss://laravel-apps.test:6001/app/Kfjaina1m7?protocol=7&client=js&version=7.0.3&flash=false' failed:

如果我像https://laravel-app1.test那样直接提供应用程序,它就可以工作。我确定我错过了一些东西,但我不知道是什么?进行连接时,上面的 URL 可能还应该包含子目录字符串,但我不知道如何更改它。

任何帮助将不胜感激,谢谢!:)

app.js

window.Echo = new Echo({
  broadcaster: 'pusher',
  key: process.env.MIX_PUSHER_APP_KEY,
  wsHost: window.location.hostname,
  wsPort: 6001,
  wssPort: 6001,
  forceTLS: true,
  disableStats: true,
});

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'),
    'host' => '127.0.0.1',
    'encrypted' => false,
    'port' => 6001,
    'scheme' => env('HTTP_SCHEME', 'http')
  ]
],
4

1 回答 1

0

那么在安全上下文中,您必须在 broadcast.php 中使用 https 模式,并在 websockets.php 配置文件中添加证书。

于 2021-09-30T12:58:44.710 回答