Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BladeRunner's avatar

websockets sockets

I have defined a Echo instance in main.js:

import Echo from "laravel-echo";

window.Pusher = require("pusher-js");

window.Echo = new Echo({
  broadcaster: "pusher",
  key: process.env.VUE_APP_WEBSOCKETS_KEY,
  wsHost: process.env.VUE_APP_WEBSOCKETS_SERVE,
  wsPort: 6001,
  forceTLS: false,
  disableStats: true,
});

and in mounted method of component:

 mounted() {
    window.Echo.channel('channel').listen('VideoConversionProgress', (e)=>{
      console.log(e)
    });
}

but i continue getting the following error:

{event: "pusher:error",…} data: {code: 4001, message: "App key local not in this cluster. Did you forget to specify the cluster?"} event: "pusher:error"

0 likes
6 replies
martinbean's avatar

@bladerunner Read the error message. It’s telling you what the problem is and how to solve it:

Did you forget to specify the cluster?

Looking at your code, it seems you have forgotten to specify the cluster, given its an option in the example code in the Laravel repository for Pusher:

https://github.com/laravel/laravel/blob/2b8f3aa506f1f2463dfdb43b063d17674b86c8cd/resources/js/bootstrap.js#L26

Error messages are meant to be read and to point you towards resolving the issue; not ignored.

BladeRunner's avatar

I have included the cluster now and it still does not work with the same error. I am not ignoring the error, Obviously I am reading it, but it is the same error if I include the cluster or if i dont include it.

martinbean's avatar
Level 80

Do you not need to re-build your JavaScript? Check the values of your configuration values. It would help if you stuck to Laravel’s conventions (MIX_PUSHER_APP_KEY, MIX_PUSHER_APP_CLUSTER, etc). Log these values and check you’re actually getting the values you’re expecting.

Your environment variables need to begin with MIX_ if you’re expecting to use them in Mix-ed JavaScript code. Yours (i.e. VUE_APP_WEBSOCKETS_KEY) don’t seem to do so.

ifr4nk's avatar

Hello, I have the same problem.

I'm using laravel websockets and this is my configuration

import Echo from 'laravel-echo'; import Pusher from 'pusher-js';

window.Pusher = Pusher;

const echo = new Echo({ broadcaster: 'pusher', key: process.env.REACT_APP_MIX_PUSHER_APP_KEY, configuración de Laravel WebSockets Host: '192.168.158.10', Port: 6001, disableStats: true, encrypted: false, cluster:process.env.REACT_APP_MIX_PUSHER_APP_CLUSTER });

export default echo;

I have the same variables in my backend and I don't know how to solve it .

Please or to participate in this conversation.