Eslam Elbadry
Eslam Elbadry

Reputation: 11

Laravel reverb auth with sanctum

I have Laravel reverb private channel and when try to listen data not return also when make it as public channel data returned successfully:

This is response from Laravel debug

In my event I make broadcast with static data but not returned.

Need when broadcast event from mobile app get data to render it .

Upvotes: 1

Views: 309

Answers (1)

Alireza Amrollahi
Alireza Amrollahi

Reputation: 915

You can try to edit your Echo.js like below ( with authentication ) :

window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
cluster: 'us2',
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws'],
authEndpoint: '/broadcasting/auth'
auth:
    {
        headers:
            {
                'Authorization': 'Bearer TOKEN'
            }
    }

});

Upvotes: 0

Related Questions