Skip to content

Commit 0464cfb

Browse files
Document synchronous stubs (#82)
* Document synchronous clients * Remove outdated migrating page
1 parent 8a64fdb commit 0464cfb

File tree

3 files changed

+45
-124
lines changed

3 files changed

+45
-124
lines changed

docs/migrating.md

Lines changed: 0 additions & 123 deletions
This file was deleted.

docs/tutorial/clients.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Clients
2+
3+
!!! warning
4+
Make sure to enable client generation when compiling your code. See [TODO link]
5+
6+
## Synchronous clients
7+
8+
Compile the following proto file in a directory called `example`, with the generation of synchronous clients activated.
9+
10+
```proto
11+
syntax = "proto3";
12+
13+
message Request {}
14+
message Response {}
15+
16+
service MyService {
17+
rpc MyRPC(Request) returns (Response);
18+
}
19+
```
20+
21+
The synchronous client can be used as follows:
22+
23+
```python
24+
import grpc
25+
26+
from example import Request, MyServiceStub
27+
28+
with grpc.insecure_channel("address:port") as channel:
29+
client = MyServiceStub(channel)
30+
31+
response = client.my_rpc(Request())
32+
```
33+
34+
## Asynchronous clients
35+
36+
### With grpcio
37+
38+
!!! warning
39+
No yet supported
40+
41+
### With grpclib
42+
43+
!!! warning
44+
Documentation not yet available

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ nav:
1515
- Getting Started: getting-started.md
1616
- Tutorial:
1717
- Messages: tutorial/messages.md
18+
- Clients: tutorial/clients.md
1819
- API: api.md
19-
- Migrating: migrating.md
2020
- Betterproto2 compiler: https://betterproto.github.io/python-betterproto2-compiler/
2121

2222
plugins:

0 commit comments

Comments
 (0)