Reputation: 125
I am using pusher in Laravel 5.4 but I'm getting following error:
WebSocket connection to 'ws://ws.pusherapp.com/app/731e32c5f123456298e?protocol=7&client=js&version=4.1.0&flash=false' failed: WebSocket is closed before the connection is established.
Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4001,"message":"Did you forget to specify the cluster when creating the Pusher instance? App key 731e32c5f123456298e does not exist in this cluster."}}}
Upvotes: 2
Views: 8019
Reputation: 348
I was facing the same issue and fixed it by adding cluster in Pusher function call of javascript:
var pusher = new Pusher('PUSHER_APP_KEY', {
cluster: 'PUSHER_APP_CLUSTER'
encrypted: true
});
Upvotes: 1
Reputation: 407
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_KEY'),
'secret' => env('PUSHER_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => <your cluster> ,
'encrypted' => true,
],
],
Specify your cluster
however if you are testing on localhost encrypted should be false
Upvotes: 1
Reputation: 741
It looks like you've copied your pusher app_key
incorrectly. Pusher app keys typically have 20 characters, yours has 19.
Upvotes: 2