File tree Expand file tree Collapse file tree 5 files changed +45
-10
lines changed Expand file tree Collapse file tree 5 files changed +45
-10
lines changed Original file line number Diff line number Diff line change @@ -12,27 +12,32 @@ 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
+
15
20
## Usage
16
21
17
22
Build and run the server using the CLI:
18
23
19
24
``` console
20
- $ swift run echo serve
25
+ $ PROTOC_PATH= $( which protoc ) swift run echo serve
21
26
Echo listening on [ipv4]127.0.0.1:1234
22
27
```
23
28
24
29
Use the CLI to make a unary 'Get' request against it:
25
30
26
31
``` console
27
- $ swift run echo get --message " Hello"
32
+ $ PROTOC_PATH= $( which protoc ) swift run echo get --message " Hello"
28
33
get → Hello
29
34
get ← Hello
30
35
```
31
36
32
37
Use the CLI to make a bidirectional streaming 'Update' request:
33
38
34
39
``` console
35
- $ swift run echo update --message " Hello World"
40
+ $ PROTOC_PATH= $( which protoc ) swift run echo update --message " Hello World"
36
41
update → Hello
37
42
update → World
38
43
update ← Hello
@@ -42,5 +47,7 @@ update ← World
42
47
Get help with the CLI by running:
43
48
44
49
``` console
45
- $ swift run echo --help
50
+ $ PROTOC_PATH= $( which protoc ) swift run echo --help
46
51
```
52
+
53
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
Original file line number Diff line number Diff line change @@ -10,12 +10,17 @@ 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
+
13
18
## Usage
14
19
15
20
Build and run the example using the CLI:
16
21
17
22
``` console
18
- $ swift run
23
+ $ PROTOC_PATH= $( which protoc ) swift run
19
24
Error code: resourceExhausted
20
25
Error message: The greeter has temporarily run out of greetings.
21
26
Error details:
@@ -24,3 +29,5 @@ Error details:
24
29
- Help links:
25
30
- https://en.wikipedia.org/wiki/Caffeine (A Wikipedia page about caffeine including its properties and effects.)
26
31
```
32
+
33
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
Original file line number Diff line number Diff line change @@ -10,25 +10,32 @@ 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
+
13
18
## Usage
14
19
15
20
Build and run the server using the CLI:
16
21
17
22
``` console
18
- $ swift run hello-world serve
23
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world serve
19
24
Greeter listening on [ipv4]127.0.0.1:31415
20
25
```
21
26
22
27
Use the CLI to send a request to the service:
23
28
24
29
``` console
25
- $ swift run hello-world greet
30
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world greet
26
31
Hello, stranger
27
32
```
28
33
29
34
Send the name of the greetee in the request by specifying a ` --name ` :
30
35
31
36
``` console
32
- $ swift run hello-world greet --name " PanCakes 🐶"
37
+ $ PROTOC_PATH= $( which protoc ) swift run hello-world greet --name " PanCakes 🐶"
33
38
Hello, PanCakes 🐶
34
39
```
40
+
41
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ 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
+
26
31
## Usage
27
32
28
33
Build and run the server using the CLI:
@@ -59,3 +64,5 @@ $ grpcurl -plaintext -d '{ "text": "Hello" }' 127.0.0.1:31415 echo.Echo.Get
59
64
"text": "Hello"
60
65
}
61
66
```
67
+
68
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
Original file line number Diff line number Diff line change @@ -15,19 +15,24 @@ 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
+
18
23
## Usage
19
24
20
25
Build and run the server using the CLI:
21
26
22
27
``` console
23
- $ swift run route-guide serve
28
+ $ PROTOC_PATH= $( which protoc ) swift run route-guide serve
24
29
server listening on [ipv4]127.0.0.1:31415
25
30
```
26
31
27
32
Use the CLI to interrogate the different RPCs you can call:
28
33
29
34
``` console
30
- $ swift run route-guide --help
35
+ $ PROTOC_PATH= $( which protoc ) swift run route-guide --help
31
36
USAGE: route-guide <subcommand>
32
37
33
38
OPTIONS:
@@ -42,3 +47,5 @@ SUBCOMMANDS:
42
47
43
48
See 'route-guide help <subcommand>' for detailed help.
44
49
```
50
+
51
+ [ 0 ] : https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation/grpcprotobuf/installing-protoc
You can’t perform that action at this time.
0 commit comments