【发布时间】:2021-08-05 19:18:13
【问题描述】:
我正在尝试使用 echo 测试和学习 laravel 的广播。但是在尝试和尝试之后,我无法实现我想要的。 它适用于公共频道。 但是当涉及到存在渠道时,它不会。 为了解决我所做的错误:
将 php 内存限制增加到 1 GB
我正在使用 Jetstream 和 Fortify。还有 InertiaJS。
浏览器调试授权标头
有错误
error: "Unable to retrieve auth string from auth endpoint - received status: 500 from /broadcasting/auth. Clients must be authenticated to join private or presence channels. See: https://pusher.com/docs/authenticating_users"
status: 500
App.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: true,
});
window.Echo.join(`chat.1`)
.here((users) => {
console.log(users);
})
.joining((user) => {
console.log(user.name);
})
.leaving((user) => {
console.log(user.name);
})
.error((error) => {
console.error(error);
});
BroadcastServiceProvider.php
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
channels.php
Broadcast::channel('chat.{ida}', function ($user, $ida) {
if (auth()->check()) {
return $user->toArray();
}
});
site.net.error.log
[Sun May 16 10:24:49.754522 2021] [fcgid:warn] [pid 14900] [client ip:38966] mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:26:31.944725 2021] [fcgid:warn] [pid 4715] [client ip:39000] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 861929472) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:26:31.954042 2021] [fcgid:warn] [pid 4715] [client ip:39000] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 861929472) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:27:12.115963 2021] [fcgid:warn] [pid 19725] [client ip:39026] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 394264576) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:27:12.120752 2021] [fcgid:warn] [pid 19725] [client ip:39026] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 394264576) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:19.624249 2021] [fcgid:warn] [pid 14898] [client ip:39066] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 710934528) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:19.636461 2021] [fcgid:warn] [pid 14898] [client ip:39066] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 710934528) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:38.961347 2021] [fcgid:warn] [pid 14898] [client ip:39086] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 551550976) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:30:38.963699 2021] [fcgid:warn] [pid 14898] [client ip:39086] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 551550976) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
[Sun May 16 10:31:03.040755 2021] [fcgid:warn] [pid 14897] [client ip:39104] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 276824064) (tried to allocate 262144 bytes) in *sitepath*/private/app_data/vendor/pusher/pusher-php-server/src/Pusher.php on line 840, referer: https://abcabc.net/dashboard
[Sun May 16 10:31:03.049553 2021] [fcgid:warn] [pid 14897] [client ip:39104] mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 276824064) (tried to allocate 262144 bytes) in Unknown on line 0, referer: https://abcabc.net/dashboard
【问题讨论】:
标签: laravel-echo inertiajs jetstream pusher-js