easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.74k stars 510 forks source link

Does it support HTTP 2? #452

Closed ashokkumar88 closed 8 months ago

XueSiLf commented 3 years ago

Are you kidding me? EasySwoole had always supported HTTP 2. First, when compiling and installing swoole, you must turn on the option --enable-http2. For details, please see https://wiki.swoole.com/#/environment?id=-enable-http2.

Second, you only need to make simple settings and modify the configuration file dev.php/produce.php, as shown below:

<?php

use EasySwoole\Log\LoggerInterface;

return [
    'SERVER_NAME' => "EasySwoole",
    'MAIN_SERVER' => [
        'LISTEN_ADDRESS' => '0.0.0.0',
        'PORT' => 9501,
        'SERVER_TYPE' => EASYSWOOLE_WEB_SERVER, //可选为 EASYSWOOLE_SERVER  EASYSWOOLE_WEB_SERVER EASYSWOOLE_WEB_SOCKET_SERVER
        'SOCK_TYPE' => SWOOLE_TCP,
        'RUN_MODEL' => SWOOLE_BASE,
        'SETTING' => [
            'worker_num' => swoole_cpu_num() * 2,
            'reload_async' => true,
            'max_wait_time' => 3,
            'open_http2_protocol' => true, # enable http2 support
        ],
        'TASK' => [
            'workerNum' => 4,
            'maxRunningNum' => 128,
            'timeout' => 15
        ]
    ],
    // ......
]