2023-01-28 17:49:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Adapterman\Adapterman;
|
|
|
|
use Workerman\Connection\TcpConnection;
|
|
|
|
use Workerman\Worker;
|
|
|
|
|
2023-01-30 16:14:07 +00:00
|
|
|
require_once __DIR__.'/vendor/autoload.php';
|
|
|
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
2023-01-28 17:49:54 +00:00
|
|
|
|
|
|
|
Adapterman::init();
|
|
|
|
|
|
|
|
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
|
|
|
|
|
|
|
$http_worker = (new Worker('http://0.0.0.0:8080'));
|
|
|
|
$http_worker->count = 8;
|
|
|
|
$http_worker->name = 'AdapterMan';
|
|
|
|
|
|
|
|
$http_worker->onMessage = static function (TcpConnection $connection) use ($kernel) {
|
|
|
|
ob_start();
|
|
|
|
|
|
|
|
$response = $kernel->handle(
|
|
|
|
$request = Illuminate\Http\Request::capture()
|
|
|
|
);
|
|
|
|
|
|
|
|
$response->send();
|
|
|
|
|
|
|
|
$kernel->terminate($request, $response);
|
|
|
|
|
|
|
|
$connection->send(ob_get_clean());
|
|
|
|
};
|
|
|
|
|
|
|
|
Worker::runAll();
|