diff --git a/broadcasting.md b/broadcasting.md index 836073b5a51..f5e6afa3984 100644 --- a/broadcasting.md +++ b/broadcasting.md @@ -23,6 +23,7 @@ - [Defining Channel Classes](#defining-channel-classes) - [Broadcasting Events](#broadcasting-events) - [Only To Others](#only-to-others) + - [Customizing The Connection](#customizing-the-connection) - [Receiving Broadcasts](#receiving-broadcasts) - [Listening For Events](#listening-for-events) - [Leaving A Channel](#leaving-a-channel) @@ -642,6 +643,41 @@ If you are not using a global Axios instance, you will need to manually configur var socketId = Echo.socketId(); + +### Customizing The Connection + +If your application interacts with multiple broadcast connections and you want to broadcast an event using a broadcaster other than your default, you may specify which connection to push an event to using the `via` method: + + use App\Events\OrderShipmentStatusUpdated; + + broadcast(new OrderShipmentStatusUpdated($update))->via('pusher'); + +Alternatively, you may specify the event's broadcast connection by calling the `broadcastVia` method within the event's constructor: + + broadcastVia('pusher'); + } + } + ## Receiving Broadcasts