Internal change

PiperOrigin-RevId: 343365350
Change-Id: If6d9f95b1407f88100f2a394d3ba2535579e147c
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2597836
Reviewed-by: Ryan Keane <rwkeane@google.com>
Commit-Queue: Ryan Keane <rwkeane@google.com>
diff --git a/cast/cast_core/api/runtime/runtime_service.proto b/cast/cast_core/api/runtime/runtime_service.proto
index 708d741..5c8c8da 100644
--- a/cast/cast_core/api/runtime/runtime_service.proto
+++ b/cast/cast_core/api/runtime/runtime_service.proto
@@ -2,6 +2,7 @@
 
 package cast.runtime;
 
+import "google/protobuf/duration.proto";
 import "cast/cast_core/api/common/service_info.proto";
 
 option optimize_for = LITE_RUNTIME;
@@ -20,6 +21,11 @@
   // If both app_id and cast_session_id are omitted, the current, "foreground"
   // application is stopped.
   rpc StopApplication(StopApplicationRequest) returns (StopApplicationResponse);
+
+  // Requests runtime to send a heartbeat in a stream. The use of server-side
+  // streaming allows Core to know for sure that runtime is still running. In
+  // case of a crash, the gRPC stream will error with UNAVAILABLE error.
+  rpc Heartbeat(HeartbeatRequest) returns (stream HeartbeatResponse);
 }
 
 message LaunchApplicationRequest {
@@ -46,3 +52,11 @@
   // If stop application was successful, the Cast session ID that was stopped.
   string cast_session_id = 2;
 }
+
+message HeartbeatRequest {
+  // Period between two heartbeat responses. The Core will wait for double of
+  // this time to avoid network glitches. The minimum value is 5 seconds.
+  google.protobuf.Duration heartbeat_period = 1;
+}
+
+message HeartbeatResponse {}