From ed2e7857276ef68dc596cb26f8f5a742caa3d9e3 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 9 Apr 2018 12:20:12 +0200 Subject: [PATCH] Forward compatibility with react/event-loop 1.0 and 0.5 while still supporting 0.4 --- Examples/FullBufferTest/StartClient.php | 10 ++-------- composer.json | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Examples/FullBufferTest/StartClient.php b/Examples/FullBufferTest/StartClient.php index 1b426f36..25341624 100644 --- a/Examples/FullBufferTest/StartClient.php +++ b/Examples/FullBufferTest/StartClient.php @@ -13,19 +13,13 @@ $loop = $client->getLoop(); -$looping = true; $loop->addTimer( 5, - function () use (&$looping) { - $looping = false; + function () use (&$loop) { + $loop->stop(); } ); -while ($looping) { - usleep(1000); - $loop->tick(); -} - echo "Looping no more...\n"; // run forever diff --git a/composer.json b/composer.json index c48e350e..503ca7a8 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "symfony/event-dispatcher": "^2.7|^3.0|^4.0", "voryx/thruway-common": "^1.0.3", "thruway/client": "^0.5.0", - "react/event-loop": "^0.4.3", + "react/event-loop": "^1.0 || ^0.5 || ^0.4.3", "react/promise": "^2.3.0", "thruway/ratchet-transport": "^0.5.0" },