share-lt/resources/js/echo.js

28 lines
916 B
JavaScript
Raw Permalink Normal View History

import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;
// Add error handling and logging
try {
console.log('Initializing Echo with:', {
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT,
scheme: import.meta.env.VITE_REVERB_SCHEME
});
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,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});
console.log('Echo initialized:', window.Echo);
} catch (error) {
console.error('Failed to initialize Echo:', error);
}