This commit is contained in:
2020-09-02 12:04:43 +08:00
parent f777078821
commit a2124ea874
+9
View File
@@ -8,6 +8,8 @@ use HttpServer\Events\OnConnect;
use HttpServer\Events\OnPacket; use HttpServer\Events\OnPacket;
use HttpServer\Events\OnReceive; use HttpServer\Events\OnReceive;
use HttpServer\Events\OnRequest; use HttpServer\Events\OnRequest;
use HttpServer\Route\Annotation\Annotation;
use HttpServer\Route\Annotation\Tcp;
use HttpServer\Service\Http; use HttpServer\Service\Http;
use HttpServer\Service\Receive; use HttpServer\Service\Receive;
use HttpServer\Service\Packet; use HttpServer\Service\Packet;
@@ -19,6 +21,7 @@ use Snowflake\Exception\ConfigException;
use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Process; use Swoole\Process;
use HttpServer\Route\Annotation\Websocket as AWebsocket;
/** /**
* Class Server * Class Server
@@ -62,6 +65,12 @@ class Server extends Application
if ($this->baseServer) { if ($this->baseServer) {
return $this->getServer(); return $this->getServer();
} }
$annotation = Snowflake::get()->annotation;
$annotation->register('tcp',Tcp::class);
$annotation->register('http',Annotation::class);
$annotation->register('websocket',AWebsocket::class);
$configs = $this->sortServers($configs); $configs = $this->sortServers($configs);
foreach ($configs as $server) { foreach ($configs as $server) {
$this->create($server); $this->create($server);