2

I'm trying to use redis as a default broadcaster in laravel here is my .env fille

QUEUE_DRIVER=sync
APP_ENV=local
APP_DEBUG=true
APP_KEY=***********
DB_HOST=***************
DB_PORT=******************
DB_DATABASE=***************

DB_USERNAME=***********
DB_PASSWORD=*************

CACHE_DRIVER=file
SESSION_DRIVER=file

BROADCAST_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

I'm using this event class to broadcast

 <?php

namespace App\Events;

use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
use Log ;
class SomeEvent extends Event implements ShouldBroadcast
{
    use SerializesModels;

    public $data;

    public function __construct($room, $data)
    {
        Log::debug($room);
        Log::debug($data);

        $this->data = array(
            'room' => $room,
            'data' => $data
        );
    }

    public function broadcastOn()
    {
        Log::debug('in channel!!!');

        return ['test-channel'];
    }
}

when i fire the event inside a controller using

 event(new SomeEvent("test room", "test message"));

I get the following error

[2016-02-29 19:17:38] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Pusher' not found' in C:\xampp\htdocs\TechInsights\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php:132
Stack trace:

The most strange thing is when i change the method createPusherDriver inside the BroadcastManager.php

from

 protected function createPusherDriver(array $config)
    {
        return new PusherBroadcaster(
            new Pusher($config['key'], $config['secret'], $config['app_id'], Arr::get($config, 'options', []))
        );
    }

to

  protected function createPusherDriver(array $config)
    {
        return new RedisBroadcaster(
            $this->app->make('redis'), Arr::get($config, 'connection')
        );
    }

the event broadcasts in redis without any issue ! any ideas ? Why laravel using pusher even if i configured it to use redis ? what i'm missing ?

1 Answer 1

4

Have you tried clearing your config cache?

php artisan config:clear
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.