-
-
Save kelunik/79f843c541aceb3927c5463cc643d502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . "/vendor/autoload.php"; | |
$loop = React\EventLoop\Factory::create(); | |
$server = new React\Socket\Server("127.0.0.1:1337", $loop); | |
$server->on("connection", function ($client) use ($loop) { | |
print "New client..." . PHP_EOL; | |
$client->write("Hello World." . PHP_EOL); | |
$process = new React\ChildProcess\Process("sleep 10"); | |
$process->start($loop); | |
$loop->addTimer(1, [$client, "close"]); | |
}); | |
$loop->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment