31 lines
663 B
PHP
31 lines
663 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
|
|
class FoxAudioChunk implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets;
|
|
|
|
public function __construct(public string $audioUrl) {}
|
|
|
|
public function broadcastOn(): array
|
|
{
|
|
return [new Channel('fox')];
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'audio.chunk';
|
|
}
|
|
|
|
public function broadcastWith(): array
|
|
{
|
|
return ['audio_url' => $this->audioUrl];
|
|
}
|
|
}
|