Nauman Zafar
Nauman Zafar

Reputation: 1103

Laravel and Pusher. Error connecting. Issue with App key

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.

Upvotes: 3

Views: 10848

Answers (3)

Ali Raza
Ali Raza

Reputation: 165

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

Upvotes: 0

Amjos.com
Amjos.com

Reputation: 83

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

Upvotes: 0

Haukur
Haukur

Reputation: 151

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.

Upvotes: 10

Related Questions