0

I have a project made by laravel and react I want to have a user to user chat app in my project I created a private channel in laravel now I want to connect to this channel from my react app but it gives me the following error.

http://localhost:3000/broadcasting/auth 404 (Not Found)

Here is my connection configuration to laravel websockets server

export const echoInit = token => {
       window.Pusher = require("pusher-js");
        window.Echo = new Echo({
        broadcaster: 'pusher',
        key: 'chatKey',
        cluster: 'mt1',
        wsHost: window.location.hostname,
        wsPort: 6001,
        wssPort: 6001,
        enabledTransports: ['ws', 'wss'],
        disableStats: true,
        forceTLS: false, // Set to true if you're using SSL/TLS
        encrypted: false, // Set to true if you're using SSL/TLS,
        authEndpoint: 'http://localhost:3000/broadcasting/auth',
        auth: {
            headers: {
              Authorization: 'Bearer ' + token
            },
          },
    });
}

I pass the token to this function after I am logged in. I tried a lot but did not get any result I want the user to get authenticated after the login and can subscribe to private channel.

0 Answers0