问题
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."}}}
回答1:
It looks like you've copied your pusher app_key
incorrectly. Pusher app keys typically have 20 characters, yours has 19.
回答2:
'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
来源:https://stackoverflow.com/questions/44960405/laravel-5-4-pusher-error