Files

38 lines
545 B
PHP
Raw Permalink Normal View History

2022-01-09 14:00:32 +08:00
<?php
namespace Kiri\Rpc;
2022-09-23 18:55:46 +08:00
use Exception;
2022-01-09 14:00:32 +08:00
/**
*
*/
2022-09-23 18:55:46 +08:00
class JsonRpcTransporter implements JsonRpcTransporterInterface
2022-01-09 14:00:32 +08:00
{
use TraitTransporter;
/**
2022-09-23 18:55:46 +08:00
* @param string $content
* @param string $service
* @return string|bool
* @throws RpcServiceException
* @throws Exception
2022-01-09 14:00:32 +08:00
*/
2022-09-23 18:55:46 +08:00
public function push(string $content, string $service): string|bool
2022-01-09 14:00:32 +08:00
{
2022-09-23 18:55:46 +08:00
$client = $this->get_consul($service)->newClient();
2022-01-09 14:00:32 +08:00
2022-09-23 18:55:46 +08:00
$body = $this->request($client, $content);
2022-01-09 14:00:32 +08:00
2022-09-23 18:55:46 +08:00
$client->close();
2022-06-08 17:19:32 +08:00
2022-09-23 18:55:46 +08:00
return $body;
2022-01-09 14:00:32 +08:00
}
}