Now that everything is working on the server-side it's time to turn to the client-side and look at adding the Pusher JavaScript library to the app so that the events that are being triggered on the server can be received on the client.
Open up resources/views/welcome.blade.php
and include the following script:
<script src="//js.pusher.com/3.0/pusher.min.js"></script>
<script>
var pusher = new Pusher("{{env("PUSHER_KEY")}}")
var channel = pusher.subscribe('test-channel');
channel.bind('test-event', function(data) {
alert(data.text);
});
</script>
To test this is working:
Okay, you won't be amazed. But this proves that the event is making it's way to the web browser.
Not seeing the alert? Read on...
Once you've debugged your server-side integration and are sure that your events are reaching Pusher, you'll want to debug your Pusher JavaScript integration.