Multiple Laravel Echo Instances With Different Pusher App Keys

Posted 1 month ago by tbtchan

window.alpha = new Echo({
  broadcaster: 'alpha_pusher',
  key: 'alpha-pusher-key'
});

window.beta = new Echo({
  broadcaster: 'beta_pusher',
  key: 'beta-pusher-key'
});

Is it possible to achieve this in one Laravel 5.4 project? As far as I have tried Laravel only allows us to choose one broadcast driver.

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

And in .env

BROADCAST_DRIVER=alpha_pusher

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.