Laravel WebSockets在本地主机上不显示实时统计信息 [英] Laravel websockets not showing realtime stats on localhost

查看:111
本文介绍了Laravel WebSockets在本地主机上不显示实时统计信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地主机上设置Laravel Web套接字,但是在使仪表板上的实时统计信息正常工作时遇到了困难.

I'm trying to set up Laravel web sockets on my localhost but I'm having trouble getting the Real time statistics on the dashboard working.

在我的config/broadcasting.php中,我已经根据Laravel websockets文档更新了pusher数组.

In my config/broadcasting.php I have updated the pusher array according to the Laravel websockets documentation.

'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' => true,
                'host' => '127.0.0.1',
                'port' => 6001,
                'scheme' => '
            ],
        ],

在.env上,我已经更新了广播驱动程序

On the .env I've updated the broadcast driver

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=local
PUSHER_APP_KEY=local
PUSHER_APP_SECRET=local

我还相应地更新了bootstrap.js文件,如下所示

I have also accordingly updated the bootstrap.js file as follows

import Echo from 'laravel-echo';

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'local',
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    encrypted: false,
    disableStats: true,
    wsHost: window.location.hostname,
    wsPort: 6001,
});

我要在作曲家中使用的推送器版本是

The pusher version I'm pulling in the composer is

 "pusher/pusher-php-server": "^4.1"

已经做了所有这些事情,我不明白为什么实时统计无法正常工作.我从控制台收到的错误是

Having done all that, I do not understand why the real time statistics are not working. The errors I'm getting from the console are

POST http://127.0.0.1/laravel-websockets/auth 404 (Not Found)
GET http://127.0.0.1/laravel-websockets/api/local/statistics 404 (Not Found)

我在Windows上并且正在使用xampp.

I'm on Windows and using xampp.

推荐答案

config/websockts.php 上,更改 enable_statistics = true

'apps' => [
    [
        '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,
    ],
],

这篇关于Laravel WebSockets在本地主机上不显示实时统计信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆