Skip to content

Instantly share code, notes, and snippets.

@Ghostscypher
Last active September 7, 2021 12:48
Show Gist options
  • Save Ghostscypher/f7cfa67eb187b7ca5922b057df69341d to your computer and use it in GitHub Desktop.
Save Ghostscypher/f7cfa67eb187b7ca5922b057df69341d to your computer and use it in GitHub Desktop.
/*
* Decicated echo js file
*/
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
// If using http connection use this
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
wsHost: 'example.com', // Your domain
encrypted: false,
wsPort: 80, // Yor http port
disableStats: true, // Change this to your liking this disables statistics
forceTLS: false,
enabledTransports: ['ws', 'wss'],
disabledTransports: ['sockjs', 'xhr_polling', 'xhr_streaming'] // Can be removed
});
// For ssl connections use this
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
wsHost: 'example.com', // Your domain
encrypted: true,
wssPort: 443, // Https port
disableStats: true, // Change this to your liking this disables statistics
forceTLS: true,
enabledTransports: ['ws', 'wss'],
disabledTransports: ['sockjs', 'xhr_polling', 'xhr_streaming'] // Can be removed
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment