Skip to content

Commit

Permalink
Merge pull request #54 from clue-labs/default-loop
Browse files Browse the repository at this point in the history
Simplify usage by updating to new default loop
  • Loading branch information
WyriHaximus authored Jul 11, 2021
2 parents dd9d741 + cc84ef1 commit 3744003
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions theme/homepage.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
<div class="welcome__example">
{% markdown %}
```php
$loop = React\EventLoop\Factory::create();

$server = new React\Http\Server($loop, function (Psr\Http\Message\ServerRequestInterface $request) {
$server = new React\Http\Server(function (Psr\Http\Message\ServerRequestInterface $request) {
return new React\Http\Message\Response(
200,
array(
Expand All @@ -53,15 +51,13 @@ $server = new React\Http\Server($loop, function (Psr\Http\Message\ServerRequestI
);
});

$socket = new React\Socket\Server(8080, $loop);
$socket = new React\Socket\Server('127.0.0.1:8080');
$server->listen($socket);

echo "Server running at http://127.0.0.1:8080\n";

$loop->run();
echo "Server running at http://127.0.0.1:8080" . PHP_EOL;
```
{% endmarkdown %}
<p class="center">This simple web server written in ReactPHP responds with "Hello World" for every request.</p>
<p class="center">This simple web server written in ReactPHP responds with "Hello World!" for every request.</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 3744003

Please sign in to comment.