Configuration parameter

RPC service startup has two ways to start and integrate other services (Http/Websocket) separately, in either case, first configure RPC in bean.php.

 return [
    'rpcServer'  => [
        'class' => ServiceServer::class,
        'port' => 18308,
    ],
] 
  • Port configuration startup port number
  • Setting startup configuration parameters, corresponding to swooleServer->setting

Integrate RPC services in Http server startup:

 return [
    'httpServer' => [
        'class'    => HttpServer::class,
        'port'     => 18306,
        'listener' => [
            'rpc' => bean('rpcServer')
        ],

        // ...
    ],
] 
  • Listener listens to an RPC service separately and can listen to multiple RPC services at the same time

If it is started separately, invalid other configurations can be started directly.

/docs/2.x/en/rpc-server/setting.html
progress-bar