ServerInterface.php 927 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Server;
  12. use Psr\Container\ContainerInterface;
  13. use Psr\EventDispatcher\EventDispatcherInterface;
  14. use Psr\Log\LoggerInterface;
  15. use Swoole\Coroutine\Server as SwooleCoServer;
  16. use Swoole\Server as SwooleServer;
  17. interface ServerInterface
  18. {
  19. public const SERVER_HTTP = 1;
  20. public const SERVER_WEBSOCKET = 2;
  21. public const SERVER_BASE = 3;
  22. public function __construct(ContainerInterface $container, LoggerInterface $logger, EventDispatcherInterface $dispatcher);
  23. public function init(ServerConfig $config): ServerInterface;
  24. public function start(): void;
  25. /**
  26. * @return SwooleCoServer|SwooleServer
  27. */
  28. public function getServer();
  29. }