Skip to content

Commit

Permalink
toc for examples in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Apr 21, 2020
1 parent 3e5c8f2 commit bc07136
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions www/docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ id: examples
title: Examples
---

<AUTOGENERATED_TABLE_OF_CONTENTS>

- [A simple insecure unary call](#simple-unary)
- [Server reflection](#server-reflection)
- [Metadata using template variables](#metadata-template)
- [Binary data](#binary-data)
- [Variable data for unary calls](#variable-data)
- [Custom parameters](#custom-parameters)
- [Protoset](#protoset)
- [Config file](#config)
- [Debug logging](#debug)
- [Client streaming](#client-stream)
- [Server streaming](#server-stream)
- [Well Known Types](#wkt)


<a name="simple-unary">
### A simple insecure unary call:

```sh
Expand All @@ -15,6 +28,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="server-reflection">
### Server reflection

Or same test using [server reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) (just omit `-proto` option):
Expand All @@ -26,6 +40,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="metadata-template">
### Metadata using template variables

A simple unary call with metadata using template actions:
Expand All @@ -39,6 +54,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="binary-data">
### Binary data

Using binary data file (see [writing a message](https://developers.google.com/protocol-buffers/docs/gotutorial#writing-a-message)):
Expand All @@ -58,6 +74,7 @@ ghz --proto ./greeter.proto \
0.0.0.0:50051 < ./hello_request_data.bin
```

<a name="variable-data">
### Variable data for unary calls

Round-robin of messages for unary call:
Expand All @@ -70,6 +87,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="custom-parameters">
### Custom parameters

Custom number of requests and concurrency:
Expand Down Expand Up @@ -106,6 +124,7 @@ ghz --proto ./greeter.proto \
0.0.0.0:50051
```

<a name="protoset">
### Protoset

If a single object is given for data it is sent as every message.
Expand Down Expand Up @@ -136,6 +155,7 @@ Alternatively `ghz` can be used with [Prototool](https://github.com/uber/prototo
ghz --protoset $(prototool descriptor-set --include-imports --tmp) ...
```

<a name="config">
### Config file

Finally we can specify all settings, including the target host, conveniently in a JSON or TOML config file.
Expand All @@ -150,6 +170,7 @@ Config file settings can be combined with command line arguments. CLI options ov
ghz --config ./config.json -c 20 -n 1000
```

<a name="debug">
### Debug logging

With debug logging enabled:
Expand All @@ -163,6 +184,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="client-stream">
### Client streaming

Client streaming with metadata:
Expand All @@ -176,6 +198,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="server-stream">
### Server streaming

Server streaming with metadata:
Expand All @@ -189,6 +212,7 @@ ghz --insecure \
0.0.0.0:50051
```

<a name="wkt">
### Well Known Types

[Well known types](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) can be used:
Expand Down

0 comments on commit bc07136

Please sign in to comment.