Sletheren Sletheren - 28 days ago 6
AngularJS Question

Integrating Pusher with Laravel and Ionic 1( AngularJS) in chat app

I'm trying to set up a chat application with the following stack (Laravel, AngularJS, Ionic, Pusher)
I'm using AngularJS v1.6.x and Laravel 5.3 (which has already Pusher integrated with it per default)
So I followed the docs to create a pusher account, and set up an Event in laravel with broadcasting and everything, and in the front-end (Ionic side) I have to add Pusher, which made me a bit confused since in pretty much all the tutorials they mentioned using Laravel Echo or Redis/Socket.IO

So my question how can I make this architecture work from the AngularJS side, do I only need to include the Pusher javascript file and declare the channel and work or is there something else I can do.


Answer Source

I figured it out! for anyone out there who has problems setting up Pusher with Laravel, here are the steps to follow:

  • Add Pusher to laravel using composer (composer require pusher/pusher-php-server)

  • Inside your .env file add:


  • Set the broadcast driver to pusher:


  • Inside config/Broadcasting.php

'pusher' => [
  'driver' => 'pusher',
  'key' => env('PUSHER_APP_KEY'),
  'secret' => env('PUSHER_APP_SECRET'),
  'app_id' => env('PUSHER_APP_ID'),
  'options' => [
    'cluster' => 'eu',
    'encrypted' => true
  • create an event that gonna be broadcastable