laravel sanctum authorizing private broadcast channels

Solutions on MaxInterview for laravel sanctum authorizing private broadcast channels by the best coders in the world

showing results for - "laravel sanctum authorizing private broadcast channels"
Annmarie
07 Nov 2019
1window.Echo = new Echo({
2    broadcaster: "pusher",
3    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
4    encrypted: true,
5    key: process.env.MIX_PUSHER_APP_KEY,
6    authorizer: (channel, options) => {
7        return {
8            authorize: (socketId, callback) => {
9                axios.post('/api/broadcasting/auth', {
10                    socket_id: socketId,
11                    channel_name: channel.name
12                })
13                .then(response => {
14                    callback(false, response.data);
15                })
16                .catch(error => {
17                    callback(true, error);
18                });
19            }
20        };
21    },
22})