Skip to content

Commit 1d45259

Browse files
committed
Add DownloadProgress event for real-time update broadcasting
This event handles broadcasting download progress updates through a 'nativephp' channel. It includes details such as total size, delta, transferred bytes, percentage completed, and speed.
1 parent 3a106aa commit 1d45259

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Native\Laravel\Events\AutoUpdater;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class DownloadProgress implements ShouldBroadcastNow
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
public function __construct(public float $total, public float $delta, public float $transferred, public float $percent, public float $bytesPerSecond) {}
16+
17+
public function broadcastOn()
18+
{
19+
return [
20+
new Channel('nativephp'),
21+
];
22+
}
23+
}

0 commit comments

Comments
 (0)