Reputation: 10115
I am following this tutorial to implement Pusher in Laravel 5.4
Below were the step by step things done.
composer require pusher/pusher-php-server
npm install --save laravel-echo pusher-js
resources/assets/js/bootstrap.js
env
and in bootstrap.js
file.Finally, I wrote below code in blade.
<script>
debugger;
window.Echo.channel('SendMessageChannel.1')
.listen('.App.Events.SendMessageEvent', (e) => {
console.log(e);
});
</script>
also added <script src="{{ asset('js/app.js') }}"></script>
reference in layout.
While debugging, I found that window.Echo is undefined.
Am I missing anything?
Upvotes: 2
Views: 3691
Reputation: 4114
Once you install laravel-echo and pusher-js, you need to run npm run dev
so that app.js can have those both libraries.
Upvotes: 2