From 75c46e1da8590a76cf5c5ee91c80d377a5292dc1 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Fri, 21 Aug 2020 19:55:23 +0800 Subject: [PATCH] Undo changes must be the redist broadcaster --- src/PubSub/Drivers/LocalClient.php | 4 ++-- src/PubSub/Drivers/RedisClient.php | 4 ++-- src/PubSub/ReplicationInterface.php | 4 ++-- tests/PubSub/RedisDriverTest.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PubSub/Drivers/LocalClient.php b/src/PubSub/Drivers/LocalClient.php index 26ac487..fe55715 100644 --- a/src/PubSub/Drivers/LocalClient.php +++ b/src/PubSub/Drivers/LocalClient.php @@ -34,10 +34,10 @@ class LocalClient implements ReplicationInterface * * @param string $appId * @param string $channel - * @param array $payload + * @param stdClass $payload * @return bool */ - public function publish($appId, string $channel, array $payload): bool + public function publish($appId, string $channel, stdClass $payload): bool { return true; } diff --git a/src/PubSub/Drivers/RedisClient.php b/src/PubSub/Drivers/RedisClient.php index 7b0b398..022faa8 100644 --- a/src/PubSub/Drivers/RedisClient.php +++ b/src/PubSub/Drivers/RedisClient.php @@ -94,10 +94,10 @@ class RedisClient extends LocalClient * * @param string $appId * @param string $channel - * @param array $payload + * @param stdClass $payload * @return bool */ - public function publish($appId, string $channel, array $payload): bool + public function publish($appId, string $channel, stdClass $payload): bool { $payload->appId = $appId; $payload->serverId = $this->getServerId(); diff --git a/src/PubSub/ReplicationInterface.php b/src/PubSub/ReplicationInterface.php index 8deb9a6..e0b39a8 100644 --- a/src/PubSub/ReplicationInterface.php +++ b/src/PubSub/ReplicationInterface.php @@ -22,10 +22,10 @@ interface ReplicationInterface * * @param string $appId * @param string $channel - * @param array $payload + * @param stdClass $payload * @return bool */ - public function publish($appId, string $channel, array $payload): bool; + public function publish($appId, string $channel, stdClass $payload): bool; /** * Subscribe to receive messages for a channel. diff --git a/tests/PubSub/RedisDriverTest.php b/tests/PubSub/RedisDriverTest.php index c67ab88..e6585a1 100644 --- a/tests/PubSub/RedisDriverTest.php +++ b/tests/PubSub/RedisDriverTest.php @@ -30,12 +30,12 @@ class RedisDriverTest extends TestCase ], ]; - $payload = [ + $payload = json_encode([ 'appId' => '1234', 'event' => 'test', 'data' => $channelData, 'socket' => $connection->socketId, - ]; + ]); $this->getSubscribeClient()->onMessage('1234:test-channel', $payload);