- Add multi-stage Dockerfile (node-builder, composer-builder, production) - Add Nginx config with WebSocket proxy at /_ws path - Add PHP-FPM pool config, php.ini with OPcache tuning - Add Supervisord managing 7 processes: php-fpm, nginx, horizon, scheduler, reverb, pulse-check, pulse-work - Add entrypoint.sh with auto-migration, config caching, storage setup - Add .dockerignore and .env.production.example - Install laravel/horizon for production queue management and dashboard - Install laravel/pulse for production monitoring with Reverb integration - Configure TrustProxies middleware for HTTPS behind Traefik - Add horizon:snapshot to scheduler - Add VITE_REVERB_PATH for WebSocket path routing through Nginx
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import Echo from 'laravel-echo';
|
|
|
|
import Pusher from 'pusher-js';
|
|
window.Pusher = Pusher;
|
|
|
|
if (document.querySelector('[data-requires-reverb]')) {
|
|
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,
|
|
wsPath: import.meta.env.VITE_REVERB_PATH ?? '',
|
|
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
|
|
enabledTransports: ['ws', 'wss'],
|
|
});
|
|
|
|
// Handle WebSocket connection status events
|
|
const dispatchStatus = (connected) => {
|
|
window.dispatchEvent(new CustomEvent('ws-status', {
|
|
detail: { connected }
|
|
}));
|
|
};
|
|
|
|
window.Echo.connector.pusher.connection.bind('connected', () => dispatchStatus(true));
|
|
window.Echo.connector.pusher.connection.bind('unavailable', () => dispatchStatus(false));
|
|
window.Echo.connector.pusher.connection.bind('disconnected', () => dispatchStatus(false));
|
|
window.Echo.connector.pusher.connection.bind('failed', () => dispatchStatus(false));
|
|
}
|