3

Just started to use Pusher for my Laravel application. I am using Laravel's Event Broadcasting.

CLIENT SIDE

var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}");
//console.log(pusher);
var channel = pusher.subscribe('superadmin');

    channel.bind('NewUser', function(data) {
        console.log(data)
});

ISSUE

Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4001,"message":"Could not find app by key MY_PUSHER_APP_KEY. Perhaps you're connecting to the wrong cluster."}}}

ALREADY VERIFIED

  1. Pusher App Credentials.
  2. Cluster mentioned in config/broadcasting.php is the same provided by Pusher
  3. Restarted apache just to be sure.

Share your experiences with this issue.

Nauman Zafar
  • 1,083
  • 15
  • 40

3 Answers3

10

You must specify the cluster when you initialize Pusher if you're not using the default region. For instance:

const socket = new Pusher(APP_KEY, { cluster: 'eu' });

Does this solve your problem? See here for more details.

Haukur
  • 151
  • 1
  • 9
0

Try adding {{ cluster: 'eu' }} after your APP_KEY. It will work

Amjos.com
  • 83
  • 10
0

I was getting the same error. I was using PUSHER_APP_ID instead of PUSHER_APP_KEY

Ali Raza
  • 135
  • 1
  • 10