From 0a7864a54d4da9baffbbaccef52ee27cb56010d1 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Fri, 21 Aug 2020 19:12:50 +0800 Subject: [PATCH 1/6] Appears to receive an array not a class so update the type cast --- src/PubSub/Drivers/RedisClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PubSub/Drivers/RedisClient.php b/src/PubSub/Drivers/RedisClient.php index 022faa8a41..7b0b398f2e 100644 --- a/src/PubSub/Drivers/RedisClient.php +++ b/src/PubSub/Drivers/RedisClient.php @@ -94,10 +94,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): ReplicationInte * * @param string $appId * @param string $channel - * @param stdClass $payload + * @param array $payload * @return bool */ - public function publish($appId, string $channel, stdClass $payload): bool + public function publish($appId, string $channel, array $payload): bool { $payload->appId = $appId; $payload->serverId = $this->getServerId(); From a490f78f09ab952f4803dc73535a4dbd52425047 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Fri, 21 Aug 2020 19:38:59 +0800 Subject: [PATCH 2/6] Do not json encode it when it is being encoded within the publish class --- tests/PubSub/RedisDriverTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/PubSub/RedisDriverTest.php b/tests/PubSub/RedisDriverTest.php index e6585a118f..c67ab884ff 100644 --- a/tests/PubSub/RedisDriverTest.php +++ b/tests/PubSub/RedisDriverTest.php @@ -30,12 +30,12 @@ public function redis_listener_responds_properly_on_payload() ], ]; - $payload = json_encode([ + $payload = [ 'appId' => '1234', 'event' => 'test', 'data' => $channelData, 'socket' => $connection->socketId, - ]); + ]; $this->getSubscribeClient()->onMessage('1234:test-channel', $payload); From 1cd35b190bd5ff90858bbf3a27c3093c15a82ddd Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Fri, 21 Aug 2020 19:45:52 +0800 Subject: [PATCH 3/6] Update the local class and the interface --- src/PubSub/Drivers/LocalClient.php | 4 ++-- src/PubSub/ReplicationInterface.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PubSub/Drivers/LocalClient.php b/src/PubSub/Drivers/LocalClient.php index fe557158d8..26ac4876c8 100644 --- a/src/PubSub/Drivers/LocalClient.php +++ b/src/PubSub/Drivers/LocalClient.php @@ -34,10 +34,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): ReplicationInte * * @param string $appId * @param string $channel - * @param stdClass $payload + * @param array $payload * @return bool */ - public function publish($appId, string $channel, stdClass $payload): bool + public function publish($appId, string $channel, array $payload): bool { return true; } diff --git a/src/PubSub/ReplicationInterface.php b/src/PubSub/ReplicationInterface.php index e0b39a86f0..8deb9a6d0c 100644 --- a/src/PubSub/ReplicationInterface.php +++ b/src/PubSub/ReplicationInterface.php @@ -22,10 +22,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): self; * * @param string $appId * @param string $channel - * @param stdClass $payload + * @param array $payload * @return bool */ - public function publish($appId, string $channel, stdClass $payload): bool; + public function publish($appId, string $channel, array $payload): bool; /** * Subscribe to receive messages for a channel. From 75c46e1da8590a76cf5c5ee91c80d377a5292dc1 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Fri, 21 Aug 2020 19:55:23 +0800 Subject: [PATCH 4/6] 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 26ac4876c8..fe557158d8 100644 --- a/src/PubSub/Drivers/LocalClient.php +++ b/src/PubSub/Drivers/LocalClient.php @@ -34,10 +34,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): ReplicationInte * * @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 7b0b398f2e..022faa8a41 100644 --- a/src/PubSub/Drivers/RedisClient.php +++ b/src/PubSub/Drivers/RedisClient.php @@ -94,10 +94,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): ReplicationInte * * @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 8deb9a6d0c..e0b39a86f0 100644 --- a/src/PubSub/ReplicationInterface.php +++ b/src/PubSub/ReplicationInterface.php @@ -22,10 +22,10 @@ public function boot(LoopInterface $loop, $factoryClass = null): self; * * @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 c67ab884ff..e6585a118f 100644 --- a/tests/PubSub/RedisDriverTest.php +++ b/tests/PubSub/RedisDriverTest.php @@ -30,12 +30,12 @@ public function redis_listener_responds_properly_on_payload() ], ]; - $payload = [ + $payload = json_encode([ 'appId' => '1234', 'event' => 'test', 'data' => $channelData, 'socket' => $connection->socketId, - ]; + ]); $this->getSubscribeClient()->onMessage('1234:test-channel', $payload); From b6f2ce0f7c3abaa3e12c92ca4f4b7b0f214d4264 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Wed, 30 Sep 2020 11:33:16 +0800 Subject: [PATCH 5/6] Fix spelling mistake --- config/websockets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/websockets.php b/config/websockets.php index 9bb34b4d34..20938cbdcd 100644 --- a/config/websockets.php +++ b/config/websockets.php @@ -114,7 +114,7 @@ |-------------------------------------------------------------------------- | | The channel manager is responsible for storing, tracking and retrieving - | the channels as long as their memebers and connections. + | the channels as long as their members and connections. | */ From 8f2ec97d162dc073d20dae053ad68ed7e3ff2323 Mon Sep 17 00:00:00 2001 From: Nathan Rzepecki Date: Wed, 30 Sep 2020 11:33:46 +0800 Subject: [PATCH 6/6] Fix spelling mistake --- config/websockets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/websockets.php b/config/websockets.php index 20938cbdcd..b4d2c64481 100644 --- a/config/websockets.php +++ b/config/websockets.php @@ -145,7 +145,7 @@ |-------------------------------------------------------------------------- | | The channel manager is responsible for storing, tracking and retrieving - | the channels as long as their memebers and connections. + | the channels as long as their members and connections. | */