xref: /aosp_15_r20/prebuilts/android-emulator/linux-x86_64/lib/rtc_service.proto (revision d870e0501505f2fc9999364ffe386a6b6151adc1)
1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Note that if you add/remove methods in this file you must update
16// the metrics sql as well by running ./android/scripts/gen-grpc-sql.py
17//
18// Please group deleted methods in a block including the date (MM/DD/YY)
19// it was removed. This enables us to easily keep metrics around after removal
20//
21// List of deleted methods
22// rpc iWasDeleted (03/12/12)
23// ...
24syntax = "proto3";
25
26option java_multiple_files = true;
27option java_package = "com.android.emulator.control";
28option objc_class_prefix = "AEC";
29
30package android.emulation.control;
31import "google/protobuf/empty.proto";
32
33// An RTC service lets you interact with the emulator through WebRTC
34// Note that this is currently an experimental feature, and that the
35// service definition might change without notice. Use at your own risk!
36//
37// The following endpoints are needed to establish the webrtc protocol
38// Due to limitiations in Javascript we cannot make use of bidirectional
39// endpoints See this [blog](https://grpc.io/blog/state-of-grpc-web) for
40// details.
41service Rtc {
42  // This function will generate a new identifier that the client
43  // should use for further interaction. It will initiate the
44  // JSEP protocol on the server side.
45  rpc requestRtcStream(google.protobuf.Empty) returns (RtcId) {}
46
47  // Sends the given JsepMsg to the server. The RtcId in the
48  // message should point to an active stream negotiation in
49  // progress, otherwise the message will be ignored.
50  rpc sendJsepMessage(JsepMsg) returns (google.protobuf.Empty) {}
51
52  // Reads an available jsep messages for the given client id,
53  // blocking until one becomes available. Do not use the polling version
54  // above if you opt for this one.
55  //
56  // The ice candidates for example will trickle in on this callback,
57  // as will the SDP negotation.
58  rpc receiveJsepMessages(RtcId) returns (stream JsepMsg) {}
59
60
61  // [DEPRECATED] This is only here as the go grpc webproxy used
62  // by fuchsia does not support server side streaming. This method
63  // will be removed in the future and should not be relied upon.
64  //
65  // Reads an available jsep messages for the given client id,
66  // blocking until one becomes available. Do not use the polling version
67  // above if you opt for this one.
68  //
69  // The ice candidates for example will trickle in on this callback,
70  // as will the SDP negotation.
71  rpc receiveJsepMessage(RtcId) returns (JsepMsg) {}
72}
73
74message RtcId {
75  // The unique identifier of this connection. You will have to use the
76  // same identifier when sending/receiving messages. The server will
77  // generate a guid when receiving the start message.
78  string guid = 1;
79}
80
81message JsepMsg {
82  // The unique identifier of this connection. You will have to use the
83  // same identifier when sending/receiving messages. The server will
84  // generate a guid when receiving the start message.
85  RtcId id = 1;
86  // The JSON payload. This usually can be directly handled by the
87  // Javascript library.
88  //
89  // The dictionary can contain the following properties
90  //
91  // - bye:
92  //        You can hang up now. No new message expected for you.
93  //        The server has stopped the RTC stream.
94  //
95  // - start:
96  //        An RTCConfiguration dictionary providing options to
97  //        configure the new connection. This can include the
98  //        turn configuration the serve is using. This dictionary can be
99  //        passed in directly to the
100  //        [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection)
101  //        object.
102  //
103  // - candidate:
104  //        The WebRTC API's RTCIceCandidateInit dictionary, which
105  //        contains the information needed to fundamentally describe an
106  //        RTCIceCandidate. See
107  //        [RTCIceCandidate](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate)
108  //        and [Session
109  //        Lifetime](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Session_lifetime)
110  //        for more details.
111  //
112  // - sdp:
113  //        RTCSessionDescriptionInit dictionary containing the values
114  //        to that can be assigned to a
115  //        [RTCSessionDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription)
116  string message = 2;
117}
118