我正在跟踪这个包的介绍:https://beyondco.de/docs/laravel-websockets/getting-started/introduction
我正在使用进行部署,项目在本地运行良好,但部署到后不起作用。

这是我的代码websocket.php
[
'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'path' => env('PUSHER_APP_PATH'),
'capacity' => null,
'enable_client_messages' => false,
'enable_statistics' => true,
],
],broadcasting.php
'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' => true,
'encrypted' => true,
'host' => '127.0.0.1',
'port' => 6001,
'scheme' => 'https'
],
],.env
PUSHER_APP_KEY=anyKey
PUSHER_APP_SECRET=anySecret
PUSHER_APP_CLUSTER=mt1bootstrap.js
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
forceTLS: false,
wsPort: 6001,
wssPort: 6001,
enabledTransports: ['ws', 'wss'],
wsHost: window.location.hostname,
});广播路线
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('user-{user_id}-exe', function($user, $user_id) {
return $user->id == $user_id;
});composer.json
"beyondcode/laravel-websockets": "^1.12",
"pusher/pusher-php-server": "^5.0", 我做错了什么?
也许我认为这个问题是为了“我们”
发布于 2022-04-05 13:41:53
它为我解决了
.env
BROADCAST_DRIVER=pusher
PUSHER_APP_ID="test"
PUSHER_APP_KEY="test"
PUSHER_APP_SECRET="test"
PUSHER_APP_CLUSTER="test"在最后
php artisan optimize:clear发布于 2022-05-26 09:59:16
在broadcasting.php文件中注释useTLS
'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' => true,
'host' => '127.0.0.1',
'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
'scheme' => 'http'
],
],发布于 2022-05-28 05:36:45
'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',
'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
'useTLS' => true,
'scheme' => 'http',
'curl_options' => [
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
]
],
],https://stackoverflow.com/questions/70796330
复制相似问题