Khen Nursimulu | aaac7ee | 2016-12-11 22:03:52 -0500 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | package experiment; |
| 4 | |
| 5 | message AsyncEvent { |
| 6 | int32 seq = 1; |
| 7 | enum EventType { |
| 8 | BIG_BANG = 0; // just a big bang |
| 9 | SMALL_BANG = 1; // so small bang |
| 10 | NO_BANG = 2; |
| 11 | } |
| 12 | EventType type = 2; |
| 13 | string details = 3; |
| 14 | } |
| 15 | |
| 16 | enum SimpleEnum { |
| 17 | APPLE = 0; |
| 18 | BANANA = 1; |
| 19 | ORANGE = 2; |
| 20 | } |
| 21 | |
| 22 | message Packet { |
| 23 | int32 source = 1; |
| 24 | bytes content = 2; |
| 25 | message InnerPacket { |
| 26 | string url = 1; |
| 27 | string title = 2; |
| 28 | repeated string snippets = 3; |
| 29 | message InnerInnerPacket { |
| 30 | string input = 1; |
| 31 | string desc = 2; |
| 32 | } |
| 33 | repeated InnerInnerPacket inner_inner_packet = 4; |
| 34 | } |
| 35 | repeated InnerPacket inner_packets = 3; |
| 36 | } |
| 37 | |
| 38 | message Echo { |
| 39 | string msg = 1; |
| 40 | float delay = 2; |
| 41 | } |
| 42 | |
| 43 | message testMessage{ |
| 44 | oneof oneOfTest { |
| 45 | string test2 = 1; |
| 46 | int32 test3 = 2; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | service ExperimentalService { |
| 51 | |
| 52 | rpc GetEcho(Echo) returns(Echo); |
| 53 | |
| 54 | // For server to send async stream to client |
| 55 | rpc ReceiveStreamedEvents(Packet) |
| 56 | returns(stream AsyncEvent); |
| 57 | |
| 58 | // For server to send async packets to client |
| 59 | rpc ReceivePackets(Echo) returns(stream Packet); |
| 60 | |
| 61 | // For client to send async packets to server |
| 62 | rpc SendPackets(stream Packet) returns(Echo); |
| 63 | |
| 64 | } |