This commit is contained in:
2021-10-28 18:24:46 +08:00
parent d29020f065
commit c7f4b8a0f7
8 changed files with 292 additions and 34 deletions
+12
View File
@@ -6,6 +6,8 @@ use Annotation\Annotation;
use Annotation\Inject;
use Http\Handler\Router;
use Kiri\Abstracts\Component;
use Kiri\Abstracts\Config;
use Kiri\Di\ContainerInterface;
use Kiri\Di\NoteManager;
use Kiri\Kiri;
use Server\SInterface\OnCloseInterface;
@@ -31,6 +33,10 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
public Annotation $annotation;
#[Inject(ContainerInterface::class)]
public ContainerInterface $container;
/**
*
* @throws \Exception
@@ -56,6 +62,12 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
}
}
}
$config = Config::get('rpc.pool', null);
if (!is_null($config)) {
$this->container->mapping(RpcClientInterface::class, JsonRpcPoolTransporter::class);
} else {
$this->container->mapping(RpcClientInterface::class, JsonRpcTransporter::class);
}
}