06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Events 351<br />

• Pusher: pusher/pusher-php-server ∼2.0<br />

• Redis: predis/predis ∼1.0<br />

Queue Prerequisites<br />

Before broadcasting events, you will also need to configure and run a queue listener. All event<br />

broadcasting is done via queued jobs so that the response time of your application is not seriously<br />

affected.<br />

Marking Events For Broadcast<br />

To inform Laravel that a given event should be broadcast, implement the Illuminate\Contracts\Broadcasting\Sho<br />

interface on the event class. The ShouldBroadcast interface requires you to implement a single<br />

method: broadcastOn. The broadcastOn method should return an array of “channel” names that<br />

the event should be broadcast on:<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!