People searching “ShouldBroadcast Vue” implement ShouldBroadcastNow and then every save waits on the socket. ShouldBroadcast implements the queue. The event class, the public channel, and useEchoPublic are already in the Reverb guide. This page is the interface and the worker.
TL;DR
- ShouldBroadcast queues the event.
- ShouldBroadcastNow runs it inside the request.
- The Vue listener is the Reverb guide.
- Do not listen with
useEchoon a public channel.
The fix#
class PostPublished implements ShouldBroadcast
{
// broadcastOn stays the public Channel from the Reverb guide
}PostPublished::dispatch($post) after the row exists. Nothing reaches the browser until a worker is running. Local:
php artisan queue:listenIf the title never appears, check the worker before you rewrite the Vue listener. ShouldBroadcastNow is the tool when the event must go out before the response, and you accept the cost. A post save is not that case.
What to avoid#
Gotcha
Do not listen with useEcho on a public channel. The Reverb guide shows why that hook asks for a private channel and then misses this event. Do not put the provider key, or the Reverb secret, in the event payload.
FAQ#
How do I queue a broadcast instead of blocking the save?
ShouldBroadcast queues the event. ShouldBroadcastNow runs it inside the request. The Vue listener is the Reverb guide.
What goes wrong with ShouldBroadcast Vue?
Many developers implement ShouldBroadcastNow and then every save waits on the socket. Do not listen with useEcho on a public channel.



