diff --git a/src/Protocols/Pusher/MetricsHandler.php b/src/Protocols/Pusher/MetricsHandler.php index a58d2262..64671ee8 100644 --- a/src/Protocols/Pusher/MetricsHandler.php +++ b/src/Protocols/Pusher/MetricsHandler.php @@ -214,8 +214,8 @@ protected function listenForMetrics(string $key): Deferred $deferred = new Deferred; $this->pubSubProvider->on('metrics-retrieved', function ($payload) use ($key, $deferred) { - dump('Metrics received for '.$key, $payload); - + dump('Metrics received for '.$key); + if ($payload['key'] !== $key) { return; } diff --git a/src/Protocols/Pusher/PusherPubSubIncomingMessageHandler.php b/src/Protocols/Pusher/PusherPubSubIncomingMessageHandler.php index 1c3ead09..55db23e3 100644 --- a/src/Protocols/Pusher/PusherPubSubIncomingMessageHandler.php +++ b/src/Protocols/Pusher/PusherPubSubIncomingMessageHandler.php @@ -12,7 +12,6 @@ class PusherPubSubIncomingMessageHandler implements PubSubIncomingMessageHandler */ public function handle(string $payload): void { - dump($payload); $event = json_decode($payload, associative: true, flags: JSON_THROW_ON_ERROR); $application = unserialize($event['application']); diff --git a/src/Servers/Reverb/Publishing/RedisPubSubProvider.php b/src/Servers/Reverb/Publishing/RedisPubSubProvider.php index 933b347a..e7dd736c 100644 --- a/src/Servers/Reverb/Publishing/RedisPubSubProvider.php +++ b/src/Servers/Reverb/Publishing/RedisPubSubProvider.php @@ -52,9 +52,12 @@ public function subscribe(): void $this->ensureConnected(); $this->subscribingClient->subscribe($this->channel) - ->then(fn () => $this->subscribingClient->on('message', function (string $channel, string $payload) { - $this->messageHandler->handle($payload); - })); + ->then(function () { + dump('Subscribed to pubsub'); + $this->subscribingClient->on('message', function (string $channel, string $payload) { + $this->messageHandler->handle($payload); + }); + }); } /**