Skip to content

Commit

Permalink
feat:readme
Browse files Browse the repository at this point in the history
  • Loading branch information
onanying committed Jul 14, 2021
1 parent 71ed2a0 commit 3edafcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ protoc --php_out=. --mix_out=. greeter.proto

```php
// 编写一个服务,实现 protoc-gen-mix 生成的接口
class SayService implements \Php\Micro\Grpc\Greeter\SayInterface
class SayService implements Php\Micro\Grpc\Greeter\SayInterface
{

public function Hello(\Mix\Context\Context $context, \Php\Micro\Grpc\Greeter\Request $request): \Php\Micro\Grpc\Greeter\Response
public function Hello(Mix\Grpc\Context $context, Php\Micro\Grpc\Greeter\Request $request): Php\Micro\Grpc\Greeter\Response
{
$response = new \Php\Micro\Grpc\Greeter\Response();
$response = new Php\Micro\Grpc\Greeter\Response();
$response->setMsg(sprintf('hello, %s', $request->getName()));
return $response;
}
Expand Down Expand Up @@ -148,6 +148,10 @@ Swoole 单进程 (协程) 中使用
```php
Swoole\Coroutine\run(function () use ($grpc) {
$server = new Swoole\Coroutine\Http\Server('0.0.0.0', 9595, false);
$server->set([
'open_http2_protocol' => true,
'http_compression' => false,
]);
$server->handle('/', $grpc->handler());
$server->start();
});
Expand Down
2 changes: 1 addition & 1 deletion protos/Php/Micro/Grpc/Greeter/SayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Php\Micro\Grpc\Greeter;

use Mix\Grpc;
use Mix\Context\Context;
use Mix\Grpc\Context;

interface SayInterface extends Grpc\ServiceInterface
{
Expand Down

0 comments on commit 3edafcc

Please sign in to comment.