File tree 5 files changed +70
-10
lines changed
5 files changed +70
-10
lines changed Original file line number Diff line number Diff line change @@ -12,27 +12,36 @@ the four RPC types.
12
12
The tool uses the [ SwiftNIO] ( https://github.com/grpc/grpc-swift-nio-transport )
13
13
HTTP/2 transport.
14
14
15
+ ## Prerequisites
16
+
17
+ You must have the Protocol Buffers compiler (` protoc ` ) installed. You can find
18
+ the instructions for doing this in the [ gRPC Swift Protobuf documentation] [ 0 ] .
19
+ The ` swift ` commands below are all prefixed with ` PROTOC_PATH=$(which protoc) ` ,
20
+ this is to let the build system know where ` protoc ` is located so that it can
21
+ generate stubs for you. You can read more about it in the [ gRPC Swift Protobuf
22
+ documentation] [ 1 ] .
23
+
15
24
## Usage
16
25
17
26
Build and run the server using the CLI:
18
27
19
28
``` console
20
- $ swift run echo serve
29
+ $ PROTOC_PATH= $( which protoc ) swift run echo serve
21
30
Echo listening on [ipv4]127.0.0.1:1234
22
31
```
23
32
24
33
Use the CLI to make a unary 'Get' request against it:
25
34
26
35
``` console
27
- $ swift run echo get --message " Hello"
36
+ $ PROTOC_PATH= $( which protoc ) swift run echo get --message " Hello"
28
37
get → Hello
29
38
get ← Hello
30
39
```
31
40
32
41
Use the CLI to make a bidirectional streaming 'Update' request:
33
42
34
43
``` console
35
- $ swift run echo update --message " Hello World"
44
+ $ PROTOC_PATH= $( which protoc ) swift run echo update --message " Hello World"
36
45
update → Hello
37
46
update → World
38
47
update ← Hello
@@ -42,5 +51,8 @@ update ← World
42
51
Get help with the CLI by running:
43
52
44
53
``` console
45
- $ swift run echo --help
54
+ $ PROTOC_PATH= $( which protoc ) swift run echo --help
46
55
```
56
+
57
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
58
+ [ 1 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/generating-stubs
Original file line number Diff line number Diff line change @@ -10,12 +10,21 @@ described in more detailed in the [gRPC Error
10
10
Guide] ( https://grpc.io/docs/guides/error/ ) and is made available via the
11
11
[ grpc-swift-protobuf] ( https://github.com/grpc-swift-protobuf ) package.
12
12
13
+ ## Prerequisites
14
+
15
+ You must have the Protocol Buffers compiler (` protoc ` ) installed. You can find
16
+ the instructions for doing this in the [ gRPC Swift Protobuf documentation] [ 0 ] .
17
+ The ` swift ` commands below are all prefixed with ` PROTOC_PATH=$(which protoc) ` ,
18
+ this is to let the build system know where ` protoc ` is located so that it can
19
+ generate stubs for you. You can read more about it in the [ gRPC Swift Protobuf
20
+ documentation] [ 1 ] .
21
+
13
22
## Usage
14
23
15
24
Build and run the example using the CLI:
16
25
17
26
``` console
18
- $ swift run
27
+ $ PROTOC_PATH= $( which protoc ) swift run
19
28
Error code: resourceExhausted
20
29
Error message: The greeter has temporarily run out of greetings.
21
30
Error details:
@@ -24,3 +33,6 @@ Error details:
24
33
- Help links:
25
34
- https://en.wikipedia.org/wiki/Caffeine (A Wikipedia page about caffeine including its properties and effects.)
26
35
```
36
+
37
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
38
+ [ 1 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/generating-stubs
Original file line number Diff line number Diff line change @@ -10,25 +10,37 @@ service which allows you to start a server and to make requests against it.
10
10
The tool uses the [ SwiftNIO] ( https://github.com/grpc/grpc-swift-nio-transport )
11
11
HTTP/2 transport.
12
12
13
+ ## Prerequisites
14
+
15
+ You must have the Protocol Buffers compiler (` protoc ` ) installed. You can find
16
+ the instructions for doing this in the [ gRPC Swift Protobuf documentation] [ 0 ] .
17
+ The ` swift ` commands below are all prefixed with ` PROTOC_PATH=$(which protoc) ` ,
18
+ this is to let the build system know where ` protoc ` is located so that it can
19
+ generate stubs for you. You can read more about it in the [ gRPC Swift Protobuf
20
+ documentation] [ 1 ] .
21
+
13
22
## Usage
14
23
15
24
Build and run the server using the CLI:
16
25
17
26
``` console
18
- $ swift run hello-world serve
27
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world serve
19
28
Greeter listening on [ipv4]127.0.0.1:31415
20
29
```
21
30
22
31
Use the CLI to send a request to the service:
23
32
24
33
``` console
25
- $ swift run hello-world greet
34
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world greet
26
35
Hello, stranger
27
36
```
28
37
29
38
Send the name of the greetee in the request by specifying a ` --name ` :
30
39
31
40
``` console
32
- $ swift run hello-world greet --name " PanCakes 🐶"
41
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world greet --name " PanCakes 🐶"
33
42
Hello, PanCakes 🐶
34
43
```
44
+
45
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
46
+ [ 1 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/generating-stubs
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ protoc --descriptor_set_out=path/to/output.pb path/to/input.proto \
23
23
--include_imports
24
24
```
25
25
26
+ ## Prerequisites
27
+
28
+ You must have the Protocol Buffers compiler (` protoc ` ) installed. You can find
29
+ the instructions for doing this in the [ gRPC Swift Protobuf documentation] [ 0 ] .
30
+ The ` swift ` commands below are all prefixed with ` PROTOC_PATH=$(which protoc) ` ,
31
+ this is to let the build system know where ` protoc ` is located so that it can
32
+ generate stubs for you. You can read more about it in the [ gRPC Swift Protobuf
33
+ documentation] [ 1 ] .
34
+
26
35
## Usage
27
36
28
37
Build and run the server using the CLI:
@@ -59,3 +68,6 @@ $ grpcurl -plaintext -d '{ "text": "Hello" }' 127.0.0.1:31415 echo.Echo.Get
59
68
"text": "Hello"
60
69
}
61
70
```
71
+
72
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
73
+ [ 1 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/generating-stubs
Original file line number Diff line number Diff line change @@ -15,19 +15,28 @@ HTTP/2 transport.
15
15
This example has an accompanying tutorial hosted on the [ Swift Package
16
16
Index] ( https://swiftpackageindex.com/grpc/grpc-swift/main/tutorials/grpccore/route-guide ) .
17
17
18
+ ## Prerequisites
19
+
20
+ You must have the Protocol Buffers compiler (` protoc ` ) installed. You can find
21
+ the instructions for doing this in the [ gRPC Swift Protobuf documentation] [ 0 ] .
22
+ The ` swift ` commands below are all prefixed with ` PROTOC_PATH=$(which protoc) ` ,
23
+ this is to let the build system know where ` protoc ` is located so that it can
24
+ generate stubs for you. You can read more about it in the [ gRPC Swift Protobuf
25
+ documentation] [ 1 ] .
26
+
18
27
## Usage
19
28
20
29
Build and run the server using the CLI:
21
30
22
31
``` console
23
- $ swift run route-guide serve
32
+ $ PROTOC_PATH= $( which protoc ) swift run route-guide serve
24
33
server listening on [ipv4]127.0.0.1:31415
25
34
```
26
35
27
36
Use the CLI to interrogate the different RPCs you can call:
28
37
29
38
``` console
30
- $ swift run route-guide --help
39
+ $ PROTOC_PATH= $( which protoc ) swift run route-guide --help
31
40
USAGE: route-guide <subcommand>
32
41
33
42
OPTIONS:
@@ -42,3 +51,6 @@ SUBCOMMANDS:
42
51
43
52
See 'route-guide help <subcommand>' for detailed help.
44
53
```
54
+
55
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
56
+ [ 1 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/generating-stubs
You can’t perform that action at this time.
0 commit comments