use event
This commit is contained in:
parent
11ab7ac21a
commit
adcd300a94
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace BeyondCode\LaravelWebSockets\Dashboard;
|
||||
|
||||
class EventHandler
|
||||
{
|
||||
//TODO: listen for events, pass them to Dashboard:: methods
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ namespace BeyondCode\LaravelWebSockets\Events;
|
|||
class ChannelVacated
|
||||
{
|
||||
/** @var \BeyondCode\LaravelWebSockets\Events\ConnectionInterface */
|
||||
protected $connection;
|
||||
public $connection;
|
||||
|
||||
/** @var string */
|
||||
protected $channelId;
|
||||
public $channelId;
|
||||
|
||||
public function __construct(ConnectionInterface $connection, string $channelId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Channels;
|
||||
|
||||
use BeyondCode\LaravelWebSockets\Events\ChannelVacated;
|
||||
use BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Dashboard;
|
||||
use BeyondCode\LaravelWebSockets\LaravelEcho\Pusher\Exceptions\InvalidSignatureException;
|
||||
use Illuminate\Support\Collection;
|
||||
|
|
@ -59,6 +60,7 @@ class Channel
|
|||
unset($this->subscriptions[$connection->socketId]);
|
||||
|
||||
if (! $this->hasConnections()) {
|
||||
event(new ChannelVacated($connection, $this->channelId));
|
||||
Dashboard::vacated($connection, $this->channelId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue