livekit_rtc.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. syntax = "proto3";
  2. package livekit;
  3. option go_package = "github.com/livekit/protocol/livekit";
  4. option csharp_namespace = "LiveKit.Proto";
  5. option ruby_package = "LiveKit::Proto";
  6. import "livekit_models.proto";
  7. message SignalRequest {
  8. oneof message {
  9. // initial join exchange, for publisher
  10. SessionDescription offer = 1;
  11. // participant answering publisher offer
  12. SessionDescription answer = 2;
  13. TrickleRequest trickle = 3;
  14. AddTrackRequest add_track = 4;
  15. // mute the participant's published tracks
  16. MuteTrackRequest mute = 5;
  17. // Subscribe or unsubscribe from tracks
  18. UpdateSubscription subscription = 6;
  19. // Update settings of subscribed tracks
  20. UpdateTrackSettings track_setting = 7;
  21. // Immediately terminate session
  22. LeaveRequest leave = 8;
  23. // Set active published layers, deprecated in favor of automatic tracking
  24. // SetSimulcastLayers simulcast = 9;
  25. // Update published video layers
  26. UpdateVideoLayers update_layers = 10;
  27. // Update subscriber permissions
  28. SubscriptionPermission subscription_permission = 11;
  29. // sync client's subscribe state to server during reconnect
  30. SyncState sync_state = 12;
  31. // Simulate conditions, for client validations
  32. SimulateScenario simulate = 13;
  33. // client triggered ping to server
  34. int64 ping = 14;
  35. }
  36. }
  37. message SignalResponse {
  38. oneof message {
  39. // sent when join is accepted
  40. JoinResponse join = 1;
  41. // sent when server answers publisher
  42. SessionDescription answer = 2;
  43. // sent when server is sending subscriber an offer
  44. SessionDescription offer = 3;
  45. // sent when an ICE candidate is available
  46. TrickleRequest trickle = 4;
  47. // sent when participants in the room has changed
  48. ParticipantUpdate update = 5;
  49. // sent to the participant when their track has been published
  50. TrackPublishedResponse track_published = 6;
  51. // Immediately terminate session
  52. LeaveRequest leave = 8;
  53. // server initiated mute
  54. MuteTrackRequest mute = 9;
  55. // indicates changes to speaker status, including when they've gone to not speaking
  56. SpeakersChanged speakers_changed = 10;
  57. // sent when metadata of the room has changed
  58. RoomUpdate room_update = 11;
  59. // when connection quality changed
  60. ConnectionQualityUpdate connection_quality = 12;
  61. // when streamed tracks state changed, used to notify when any of the streams were paused due to
  62. // congestion
  63. StreamStateUpdate stream_state_update = 13;
  64. // when max subscribe quality changed, used by dynamic broadcasting to disable unused layers
  65. SubscribedQualityUpdate subscribed_quality_update = 14;
  66. // when subscription permission changed
  67. SubscriptionPermissionUpdate subscription_permission_update = 15;
  68. // update the token the client was using, to prevent an active client from using an expired token
  69. string refresh_token = 16;
  70. // server initiated track unpublish
  71. TrackUnpublishedResponse track_unpublished = 17;
  72. // respond to ping
  73. int64 pong = 18;
  74. }
  75. }
  76. enum SignalTarget {
  77. PUBLISHER = 0;
  78. SUBSCRIBER = 1;
  79. }
  80. message SimulcastCodec {
  81. string codec = 1;
  82. string cid = 2;
  83. bool enable_simulcast_layers = 3;
  84. }
  85. message AddTrackRequest {
  86. // client ID of track, to match it when RTC track is received
  87. string cid = 1;
  88. string name = 2;
  89. TrackType type = 3;
  90. // to be deprecated in favor of layers
  91. uint32 width = 4;
  92. uint32 height = 5;
  93. // true to add track and initialize to muted
  94. bool muted = 6;
  95. // true if DTX (Discontinuous Transmission) is disabled for audio
  96. bool disable_dtx = 7;
  97. TrackSource source = 8;
  98. repeated VideoLayer layers = 9;
  99. repeated SimulcastCodec simulcast_codecs = 10;
  100. // server ID of track, publish new codec to exist track
  101. string sid = 11;
  102. }
  103. message TrickleRequest {
  104. string candidateInit = 1;
  105. SignalTarget target = 2;
  106. }
  107. message MuteTrackRequest {
  108. string sid = 1;
  109. bool muted = 2;
  110. }
  111. message JoinResponse {
  112. Room room = 1;
  113. ParticipantInfo participant = 2;
  114. repeated ParticipantInfo other_participants = 3;
  115. string server_version = 4;
  116. repeated ICEServer ice_servers = 5;
  117. // use subscriber as the primary PeerConnection
  118. bool subscriber_primary = 6;
  119. // when the current server isn't available, return alternate url to retry connection
  120. // when this is set, the other fields will be largely empty
  121. string alternative_url = 7;
  122. ClientConfiguration client_configuration = 8;
  123. string server_region = 9;
  124. int32 ping_timeout = 10;
  125. int32 ping_interval = 11;
  126. }
  127. message TrackPublishedResponse {
  128. string cid = 1;
  129. TrackInfo track = 2;
  130. }
  131. message TrackUnpublishedResponse {
  132. string track_sid = 1;
  133. }
  134. message SessionDescription {
  135. string type = 1; // "answer" | "offer" | "pranswer" | "rollback"
  136. string sdp = 2;
  137. }
  138. message ParticipantUpdate {
  139. repeated ParticipantInfo participants = 1;
  140. }
  141. message UpdateSubscription {
  142. repeated string track_sids = 1;
  143. bool subscribe = 2;
  144. repeated ParticipantTracks participant_tracks = 3;
  145. }
  146. message UpdateTrackSettings {
  147. repeated string track_sids = 1;
  148. // when true, the track is placed in a paused state, with no new data returned
  149. bool disabled = 3;
  150. // deprecated in favor of width & height
  151. VideoQuality quality = 4;
  152. // for video, width to receive
  153. uint32 width = 5;
  154. // for video, height to receive
  155. uint32 height = 6;
  156. }
  157. message LeaveRequest {
  158. // sent when server initiates the disconnect due to server-restart
  159. // indicates clients should attempt full-reconnect sequence
  160. bool can_reconnect = 1;
  161. DisconnectReason reason = 2;
  162. }
  163. // message to indicate published video track dimensions are changing
  164. message UpdateVideoLayers {
  165. string track_sid = 1;
  166. repeated VideoLayer layers = 2;
  167. }
  168. message ICEServer {
  169. repeated string urls = 1;
  170. string username = 2;
  171. string credential = 3;
  172. }
  173. message SpeakersChanged {
  174. repeated SpeakerInfo speakers = 1;
  175. }
  176. message RoomUpdate {
  177. Room room = 1;
  178. }
  179. message ConnectionQualityInfo {
  180. string participant_sid = 1;
  181. ConnectionQuality quality = 2;
  182. float score = 3;
  183. }
  184. message ConnectionQualityUpdate {
  185. repeated ConnectionQualityInfo updates = 1;
  186. }
  187. enum StreamState {
  188. ACTIVE = 0;
  189. PAUSED = 1;
  190. }
  191. message StreamStateInfo {
  192. string participant_sid = 1;
  193. string track_sid = 2;
  194. StreamState state = 3;
  195. }
  196. message StreamStateUpdate {
  197. repeated StreamStateInfo stream_states = 1;
  198. }
  199. message SubscribedQuality {
  200. VideoQuality quality = 1;
  201. bool enabled = 2;
  202. }
  203. message SubscribedCodec {
  204. string codec = 1;
  205. repeated SubscribedQuality qualities = 2;
  206. }
  207. message SubscribedQualityUpdate {
  208. string track_sid = 1;
  209. repeated SubscribedQuality subscribed_qualities = 2;
  210. repeated SubscribedCodec subscribed_codecs = 3;
  211. }
  212. message TrackPermission {
  213. // permission could be granted either by participant sid or identity
  214. string participant_sid = 1;
  215. bool all_tracks = 2;
  216. repeated string track_sids = 3;
  217. string participant_identity = 4;
  218. }
  219. message SubscriptionPermission {
  220. bool all_participants = 1;
  221. repeated TrackPermission track_permissions = 2;
  222. }
  223. message SubscriptionPermissionUpdate {
  224. string participant_sid = 1;
  225. string track_sid = 2;
  226. bool allowed = 3;
  227. }
  228. message SyncState {
  229. SessionDescription answer = 1;
  230. UpdateSubscription subscription = 2;
  231. repeated TrackPublishedResponse publish_tracks = 3;
  232. repeated DataChannelInfo data_channels = 4;
  233. }
  234. message DataChannelInfo {
  235. string label = 1;
  236. uint32 id = 2;
  237. SignalTarget target = 3;
  238. }
  239. enum CandidateProtocol {
  240. UDP = 0;
  241. TCP = 1;
  242. }
  243. message SimulateScenario {
  244. oneof scenario {
  245. // simulate N seconds of speaker activity
  246. int32 speaker_update = 1;
  247. // simulate local node failure
  248. bool node_failure = 2;
  249. // simulate migration
  250. bool migration = 3;
  251. // server to send leave
  252. bool server_leave = 4;
  253. // switch candidate protocol to tcp
  254. CandidateProtocol switch_candidate_protocol = 5;
  255. }
  256. }