Workflow of httpserver startup and request in swoft

Time:2021-4-2

The basic environment of this paper is as follows
swoftcli --version
Workflow of httpserver startup and request in swoft

HTTP server directory:
/vendor/http-server/src

Server creation and start entry:
/vendor/http-server/src/HttpServer.php

Server creation code:
$this->swooleServer = new SwooleHttpServer($this->host, $this->port, $this->mode, $this->type);
Workflow of httpserver startup and request in swoft

Let’s look at the definition of swoft official website
Workflow of httpserver startup and request in swoft

Here’s the problem

Since swoft is a coroutine framework, why is the server a 'new','spool ','http','server 'instead of' spool ','coroutine','http ','server' in the demo on the official website of swoole?

To explain this, let’s look at the next code$this->startSwoole():

This method can be used in the parent class' / vendor / server / SRC '/ Server.php `) is defined as follows:

Workflow of httpserver startup and request in swoft
Here we can see that swoft implements the coroutine server by opening the coroutine before server > start()

Recommended Today

Deeply analyze the principle and practice of RSA key

1、 Preface After experiencing many dark moments in life, when you read this article, you will regret and even be angry: why didn’t you write this article earlier?! Your darkest moments include: 1. Your project needs to be connected with the bank, and the other party needs you to provide an encryption certificate. You have […]