Laravel - Broadcasting - Broadcast Name
By default, Laravel will broadcast the event using the event's class name. However, you may customize the broadcast name by defining a broadcastAs
method on the event:
/**
* The event's broadcast name.
*
* @return string
*/
public function broadcastAs()
{
return 'server.created';
}
If you customize the broadcast name using the broadcastAs
method, you should make sure to register your listener with a leading .
character. This will instruct Echo to not prepend the application's namespace to the event:
.listen('.server.created', function (e) {
....
});