Skip to content

Commit

Permalink
Simplify usage by updating to new default loop
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Jul 10, 2021
1 parent dd9d741 commit cc84ef1
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 cc84ef1

Please sign in to comment.