Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CookieMonster's avatar

Websocket not showing real time statistics

Gonna take a shot in a dark here for anyone using the package beyondcode/websockets. I can't seem to get my real time statistics to show anything in my websocket dashboard provided by the package.

These are my configuration:

broadcasting.php:

   'connections' => [

        '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' => 6001,
                'scheme' => 'http',
            ],
        ],
....

websocket.php:

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

My .env has the correct url:

APP_URL=http://forum.test

I am hosting mine locally using Valet so everytime I tried restarting the websocket server. the real time stats is just empty. How do I resolve this?

0 likes
2 replies
BezhanSalleh's avatar

@nickywan123 there is something wrong if it is not working so to save you some time use/follow the following steps and it works 100%.

.env

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=localapp
PUSHER_APP_KEY=localapp
PUSHER_APP_SECRET=localapp
PUSHER_APP_CLUSTER=mt1

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'),
                'encrypted' => true,
                'host' => 'trasport-web-app.test',
                'port' => 6001,
                'scheme' => 'http',
            ],
        ],

config/app:providers array uncomment the following

        App\Providers\BroadcastServiceProvider::class,

resources/js/bootstrap.js

window.Echo = new Echo({
    broadcaster: "pusher",
    key: "localapp",
    wsHost: "127.0.0.1",
    wsPort: 6001,
    disableStats: true,
    encrypted: false,
    forceTLS: false,
});

Now Create and event and start the websocket server then go to dashboard connect your app and fire the event.

et voilà !

CookieMonster's avatar

May I know why is the host set to transport-web-app.test?

Please or to participate in this conversation.