Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Laravel websockets not showing realtime stats on localhost #423

Closed
timgithinji opened this issue Jul 16, 2020 · 2 comments
Closed

Laravel websockets not showing realtime stats on localhost #423

timgithinji opened this issue Jul 16, 2020 · 2 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@timgithinji
Copy link

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.

@redalpha01
Copy link

Is your site just localhost or localhost/laravel-websockets?
I ask because /laravel-websockets is the dashboard url so if your app is only localhost, /laravel-websockets probably shouldn't be in the routes.

@rennokki rennokki added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 13, 2020
@rennokki
Copy link
Collaborator

@timgithinji So the thing with this is that it somehow worked as a counter-pattern with saving statistics by calling a controller, so it needed to resolve some domain names & co.

If you can and have the patience to see the upgrade guide for 2.x: #447, you can install 2.0.0-beta.8 that fixes this bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants