From d4993bc6b8664d439c1c7d248bd25ef371e532cf Mon Sep 17 00:00:00 2001 From: kirills-morozovs <94073530+kirills-morozovs@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:59:50 +0300 Subject: [PATCH] Dispatch an event when channel created or removed. (#242) --- src/Events/ChannelCreated.php | 19 +++++++++++++++++++ src/Events/ChannelRemoved.php | 19 +++++++++++++++++++ .../Pusher/Managers/ArrayChannelManager.php | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 src/Events/ChannelCreated.php create mode 100644 src/Events/ChannelRemoved.php diff --git a/src/Events/ChannelCreated.php b/src/Events/ChannelCreated.php new file mode 100644 index 00000000..36c6f6f5 --- /dev/null +++ b/src/Events/ChannelCreated.php @@ -0,0 +1,19 @@ +applications[$this->application->id()][$channel->name()] = $channel; + ChannelCreated::dispatch($channel); + return $channel; } @@ -109,6 +113,8 @@ public function unsubscribeFromAll(Connection $connection): void public function remove(Channel $channel): void { unset($this->applications[$this->application->id()][$channel->name()]); + + ChannelRemoved::dispatch($channel); } /**