Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
How Laravel Broadcasting Works
May 07, 2018 @ 16:41:41

The TutsPlus.com site has a new tutorial posted for the Laravel users out there ]introducing you to the framework's broadcast functionality](https://code.tutsplus.com/tutorials/how-laravel-broadcasting-works--cms-30500). Broadcasting in Laravel provides a simple interface to sending notification (such as emails or even real-time push messages) via a standardized interface.

Today, we are going to explore the concept of broadcasting in the Laravel web framework. It allows you to send notifications to the client side when something happens on the server side. In this article, we are going to use the third-party Pusher library to send notifications to the client side.

If you have ever wanted to send notifications from the server to the client when something happens on a server in Laravel, you're looking for the broadcasting feature.

The article walks through the scenario first and covers the basic flow of websockets and how they'd be used for messaging. From there they start in on the code, looking at the broadcast configuration and walking you through the setup of a Pusher account and the installation of the SDK. They help you configure the Laravel application for Pusher and install the Laravel Echo library for handling the messaging on the frontend. The tutorial goes through the code to create a "messages" table and hook in a "broadcast on" event. This is followed by the frontend setup including the Javascript to create the Pusher instance.

tagged: laravel broadcast pusher tutorial event websocket

Link: https://code.tutsplus.com/tutorials/how-laravel-broadcasting-works--cms-30500


Trending Topics: