Dear Team i am using laravel version 8.1.7, i could not figure out the bootstrap file where i need to enabled
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'mykey',
wsHost: window.location.hostname,
wsPort: 6001,
forceTLS: false,
disableStats: true,
});
kindly guide
Hi,
To enable the Laravel Echo with Pusher in your Laravel project, you need to follow these steps:
1. Install Pusher and Laravel Echo using NPM:
npm install --save pusher-js laravel-echo
import Echo from "laravel-echo";
window.Pusher = require("pusher-js");
window.Echo = new Echo({
broadcaster: "pusher",
key: "mykey",
wsHost: window.location.hostname,
wsPort: 6001,
forceTLS: false,
disableStats: true,
});
mykey
with your actual Pusher API key.mix.js("resources/js/bootstrap.js", "public/js");
You can then use Laravel Echo in your Vue components or JavaScript files as follows:
Echo.channel("channel-name")
.listen("EventName", (data) => {
console.log(data);
});