Skip to content

Commit 803e821

Browse files
committed
update README.md
1 parent 23a4c14 commit 803e821

File tree

6 files changed

+115
-25
lines changed

6 files changed

+115
-25
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1-
# go-grpc-basics
1+
# WEB+DB PRESS Vol.110 特集2「[速習]gRPC」サンプルコード
2+
3+
技術評論社刊「[WEB+DB PRESS Vol.110](https://gihyo.jp/magazine/wdpress/archive/2019/vol110)」の特集2「[速習]gRPC」のサンプルコードです。
4+
5+
## 目次
6+
7+
実行方法は各READMEをご覧ください。
8+
9+
- [単項RPC ── 1リクエスト/1レスポンス](https://github.com/vvatanabe/go-grpc-basics/tree/master/echo)
10+
- [サーバサイドストリーミングRPC ── 1リクエスト/多レスポンス](https://github.com/vvatanabe/go-grpc-basics/tree/master/downloader)
11+
- [クライアントサイドストリーミングRPC ── 多リクエスト/1レスポンス](https://github.com/vvatanabe/go-grpc-basics/tree/master/uploader)
12+
- [双方向ストリーミングRPC ── 多リクエスト/多レスポンス](https://github.com/vvatanabe/go-grpc-basics/tree/master/chat)
13+
- [gRPCのインタセプタ](https://github.com/vvatanabe/go-grpc-basics/tree/master/interceptor)
14+
15+
## 動作環境
16+
17+
サンプルコードは次の環境で動作確認済みです。
18+
19+
- Go 1.12
20+
- grpc-go 1.19.1
21+
- protobuf 3.7.0
22+
- protoc-gen-go 1.3.1
23+
24+
## ライセンス
25+
26+
サンプルコードはMITライセンスで配布しています。
27+
28+
http://opensource.org/licenses/mit-license.php
29+
30+
## お問い合わせ
31+
32+
不具合があった場合は[本書Webページ](https://gihyo.jp/magazine/wdpress/archive/2019/vol110)よりお問い合わせをお願いいたします。
33+
34+
## ご注意
35+
36+
本サンプルコード、特集の内容に基づく運用結果について、著者、ソフトウェアの開発元および提供元、株式会社技術評論社は一切の責任を負いかねますので、あらかじめご了承ください。

chat/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# simple chat using bidirectional streaming RPC
1+
# 双方向ストリーミングRPC ── 多リクエスト/多レスポンス
2+
3+
双方向ストリーミングRPCを使用した、簡易的なチャット機能の例です。
4+
5+
## .protoファイルをコンパイルする
26

37
```
4-
# build .proto
58
$ protoc -I ./chat/proto --go_out=plugins=grpc:./chat/proto/ ./chat/proto/chat.proto
9+
```
610

7-
# run server
11+
## gRPCサーバを起動する
12+
13+
```
814
$ go run ./chat/server
15+
```
16+
17+
## gRPCクライアントプログラムを実行する
918

10-
# run client
19+
引数に適当なユーザ名を与えて実行します。
20+
21+
```
1122
$ go run ./chat/client $USER_NAME
1223
```

downloader/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# file downloader using server-side streaming RPC
1+
# サーバサイドストリーミングRPC ── 1リクエスト/多レスポンス
2+
3+
サーバサイドストリーミングRPCを使用した、ファイルのダウンロード機能の例です。
4+
5+
## .protoファイルをコンパイルする
26

37
```
4-
# build .proto
58
$ protoc -I ./downloader/proto --go_out=plugins=grpc:./downloader/proto/ ./downloader/proto/file.proto
9+
```
610

7-
# run server
11+
## gRPCサーバを起動する
12+
13+
```
814
$ go run ./downloader/server
15+
```
16+
17+
## gRPCクライアントプログラムを実行する
18+
19+
引数にダウンロードするファイル名を与えて実行します。
920

10-
# run client
11-
$ go run ./downloader/client $FILE_NAME
1221
```
22+
$ go run ./downloader/client $FILE_NAME
23+
```

echo/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# echo server using unary RPC
1+
# 単項RPC ── 1リクエスト/1レスポンス
2+
3+
単項RPCを使用した、クライアントからの入力をそのまま返却するEchoサーバの例です。
4+
5+
## .protoファイルをコンパイルする
26

37
```
4-
# build .proto
58
$ protoc -I ./echo/proto --go_out=plugins=grpc:./echo/proto/ ./echo/proto/echo.proto
9+
```
610

7-
# run server
11+
## gRPCサーバを起動する
12+
13+
```
814
$ go run ./echo/server
15+
```
16+
17+
## gRPCクライアントプログラムを実行する
18+
19+
引数に適当な文言を与えて実行します。
920

10-
# run client
11-
$ go run ./echo/client hello
1221
```
22+
$ go run ./echo/client hello
23+
```

interceptor/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# echo server using interceptor
1+
# gRPCのインタセプタ
2+
3+
インタセプタを使用した例です。
4+
5+
## .protoファイルをコンパイルする
26

37
```
4-
# build .proto
58
$ protoc -I ./interceptor/proto --go_out=plugins=grpc:./interceptor/proto/ ./interceptor/proto/echo.proto
9+
```
610

7-
# run server
11+
## gRPCサーバを起動する
12+
13+
```
814
$ go run ./interceptor/server
15+
```
16+
17+
## gRPCクライアントプログラムを実行する
18+
19+
引数に適当な文言を与えて実行します。
920

10-
# run client
11-
$ go run ./interceptor/client hello
1221
```
22+
$ go run ./interceptor/client hello
23+
```

uploader/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# file uploader using client-side streaming RPC
1+
# クライアントサイドストリーミングRPC ── 多リクエスト/1レスポンス
2+
3+
クライアントサイドストリーミングRPCを使用した、ファイルのアップロード機能の例です。
4+
5+
## .protoファイルをコンパイルする
26

37
```
4-
# build .proto
58
$ protoc -I ./uploader/proto --go_out=plugins=grpc:./uploader/proto/ ./uploader/proto/file.proto
9+
```
610

7-
# run server
11+
## gRPCサーバを起動する
12+
13+
```
814
$ go run ./uploader/server
15+
```
16+
17+
## gRPCクライアントプログラムを実行する
18+
19+
引数にアップロードするファイル名を与えて実行します。
920

10-
# run client
11-
$ go run ./uploader/client $FILE_NAME
1221
```
22+
$ go run ./uploader/client $FILE_NAME
23+
```

0 commit comments

Comments
 (0)