Laravel websockets not showing realtime stats on localhost

Viewed 1891

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.

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

On the .env I've updated the broadcast driver

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

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)

I'm on Windows and using xampp.

1 Answers

On the config/websockts.php change 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,
    ],
],
Related