public function onRequest(Request $request, Response $response)
    {
        // Initialize Request and Response and set to RequestContent
        $psr7Request = \Swoft\Http\Message\Server\Request::loadFromSwooleRequest($request);
        $psr7Response = new \Swoft\Http\Message\Server\Response($response);

        /** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */
        $dispatcher = App::getBean('serverDispatcher');
        $dispatcher->dispatch($psr7Request, $psr7Response);
    }
public function onRequest(Request $request, Response $response)
    {
        // Initialize Request and Response and set to RequestContent
        $psr7Request = \Swoft\Http\Message\Server\Request::loadFromSwooleRequest($request);
        $psr7Response = new \Swoft\Http\Message\Server\Response($response);

        /** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */
        $dispatcher = App::getBean('serverDispatcher');
        $dispatcher->dispatch($psr7Request, $psr7Response);
    }
public function onRequest ( Request $ request , Response $ response ) { // Initialize Request and Response and set to RequestContent $ psr7Request = \ Swoft \ Http \ Message \ Server \ Request :: loadFromSwooleRequest ( $ request ) ; $ psr7Response = new \ Swoft \ Http \ Message \ Server \ Response ( $ response ) ; /** @var \Swoft\Http\Server\ServerDispatcher $dispatcher */ $ dispatcher = App :: getBean ( 'serverDispatcher' ) ; $ dispatcher -> dispatch ( $ psr7Request , $ psr7Response ) ; }
onRequest event callback
Each request will create an coroutine

@param Request $request
@param Response $response
@throws \InvalidArgumentException
onRequest event callback Each request will create an coroutine