ffplay example.mp3
. Дальше надо искать возможности для работы с этим процессом. $app->on(KernelEvents::CONTROLLER, function (FilterControllerEvent $event) use ($app) {
$c = $event->getController();
/** @var BaseController $controller */
$controller = $c[0];
if ($controller instanceof BaseController) {
$controller->injectApp($app);
}
});
abstract class BaseController
{
protected $app;
public function injectApp(Application $app)
{
$this->app = $app;
return $this;
}
}
class MyServer implements MessageComponentInterface
{
....
public function onError(ConnectionInterface $conn, \Exception $e)
{
DI::get()->getLogger()->error(
"An error has occurred: {$e->getMessage()}:\n{$e->getTraceAsString()}",
[__FUNCTION__]
);
$conn->close();
}
}
set_error_handler(
function ($code, $string, $errfile, $errline) {
throw new ErrorException($string, $code);
},
E_ALL | E_STRICT
);
$link = new mysqli('localhost', 'root', 'password', 'my_db');
$link->query("CALL my_stored_proc();", MYSQLI_ASYNC);
$links = $errors = $reject = array($link);
if ($link->poll($links, $errors, $reject, 0)) {
foreach ($links as $resultLink) {
if ($result = $resultLink->reap_async_query()) {
if (is_object($result)) {
$result->free();
}
}
}
}