HasLiveUpdates
trait HasLiveUpdates
Constants
| protected CHANNEL_PREFIXES |
The prefix Hypervel's channel classes add to a channel name, keyed by type. |
Properties
| protected bool | $live | Indicates if the property should receive live updates. |
|
| protected array<int, array{events: array<int, class-string|object|Channel|string>}> | $liveDeclarations | The events and channels each [live] call declared, kept per call so an explicit channel only applies to its own events. |
|
| protected int|null | $liveThrottle | The number of milliseconds to throttle live updates by. |
Methods
Determine if the property should receive live updates.
Get the number of milliseconds to throttle live updates by.
Get the live-update listeners that should refresh the property. A channel passed to [live] applies only to the events it was passed with.
Resolve the name Hypervel broadcasts the given event as.
Gather the channels the given event broadcasts on. A class name is built without its payload, which is all an event needs when its channels do not depend on one.
Read the channels off an event instance.
Get the channels the given event broadcasts on for the default connection.
Add the given events to the listener for the given channel.
Resolve the given channels into the unprefixed names and types the broadcaster sends them on.
Resolve the given channel into its unprefixed name and type. Hypervel's prefixes follow Pusher's convention, so transports get the type separately and apply their own naming.
Resolve the name of the given channel, without the prefix Hypervel's channel class added to it.
Details
at line 58
HasLiveUpdates
live(array|object|string|null $on = null, array|Channel|string|null $channel = null, int|null $throttle = null)
Mark the property as live, refreshing it whenever one of the given events is received. Merge properties cannot be live.
at line 77
bool
isLive()
Determine if the property should receive live updates.
at line 85
int|null
liveThrottle()
Get the number of milliseconds to throttle live updates by.
at line 96
array
liveListeners()
Get the live-update listeners that should refresh the property. A channel passed to [live] applies only to the events it was passed with.
at line 128
protected string
resolveEventName(object|string $event)
Resolve the name Hypervel broadcasts the given event as.
at line 168
protected array
channelsFromEvent(object|string $event)
Gather the channels the given event broadcasts on. A class name is built without its payload, which is all an event needs when its channels do not depend on one.
at line 196
protected array
broadcastChannels(object $event)
Read the channels off an event instance.
at line 223
protected array
channelsForDefaultConnection(object $event, array $channels)
Get the channels the given event broadcasts on for the default connection.
at line 253
protected void
addLiveListener(array $listeners, array $channel, array $events)
Add the given events to the listener for the given channel.
at line 275
protected array
resolveChannels(array $channels)
Resolve the given channels into the unprefixed names and types the broadcaster sends them on.
at line 322
protected array
resolveChannel(Channel|HasBroadcastChannel|string $channel)
Resolve the given channel into its unprefixed name and type. Hypervel's prefixes follow Pusher's convention, so transports get the type separately and apply their own naming.
at line 346
protected string
channelType(Channel $channel)
Resolve the type of the given channel.
at line 359
protected string
channelName(Channel $channel, string $type)
Resolve the name of the given channel, without the prefix Hypervel's channel class added to it.