import axios from 'axios';
window.axios = axios;

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';

window.Pusher = Pusher;

const { data } = await axios.get('/broadcasting/config');

window.Echo = new Echo({
    broadcaster: 'reverb',
    key: data.key,
    wsHost: data.host,
    wsPort: data.port,
    wssPort: data.port,
    forceTLS: data.scheme === 'https',
    enabledTransports: ['ws', 'wss'],
});

window.vapidPublicKey = data.vapidPublicKey;
