Skip to content

Instantly share code, notes, and snippets.

Sergey Zhuk seregazhuk

Block or report user

Report or block seregazhuk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.js
const http = require('http');
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello world');
});
server.listen('8000', '127.0.0.1');
View periodic_write.php
<?php
use React\EventLoop\Factory;
use React\Filesystem\Filesystem;
use function React\Promise\Stream\unwrapWritable;
require __DIR__ . '/../../vendor/autoload.php';
$loop = Factory::create();
$filesystem = Filesystem::create($loop);
View reactphp-middleware.php
<?php
function (ServerRequestInterface $request, \React\EventLoop\LoopInterface $loop) {
$childProcess = new \React\ChildProcess\Process('cat pages/index.html');
$childProcess->start($loop);
return new React\Http\Response(200, ['Content-Type' => 'text/html'], $childProcess->stdout);
}
View streaming-response-from-file.php
<?php
use React\Http\Server;
use React\Http\Response;
use React\EventLoop\Factory;
use Psr\Http\Message\ServerRequestInterface;
$loop = Factory::create();
You can’t perform that action at this time.