reactjslaravelpusherlaravel-echo

Laravel Echo and PusherJS setup for 2 domains


I have a project being one front end in ReactJS, which is using a laravel API.

I need to send notifications, so I use laravel echo and pusherjs.

The frontend is running on localhost:3000 and the backend is running on local-xxx.yyy.com.

Once I created my echo instance :

window.Echo = new Echo({
  broadcaster: "pusher",
  authEndPoint: "https://local-xxx.yyy.com",
  key: "XXXXX",
  cluster: "XX",
});

I join a channel :

window.Echo.private(`my-channel-name`).listen(
  "Test",
  (e) => console.log("first", e),
);

And then I got the following error in my console : http://localhost:3000/broadcasting/auth 404 (Not Found)

I tried to set different authEndPoint, it doesn't seem to affect the uri it's using. I also tried forcing TLS,but it doesn't help neither.

Any help would be greatly appreciated.

EDIT: The problem was coming from authEndPoint that should be authEndpoint.

I'm still having cors issue, but at least the url has been correctly changed.


Solution

  • The problem I was facing was a misstyping error.

    I changed authEndPoint to authEndpoint