syntax = "proto3"; package signaler; service SignalerService { rpc CreateAuthToken(CreateAuthTokenRequest) returns (AuthToken); rpc ListCameras(ListCamerasRequest) returns (ListCamerasResponse); // CreateSession creates a new session that can be seen bv the provided Camera and Peer. // // Optionally, wait_for_update can be set to prevent returning until the Camera has seen the // session request, populated candidates, and returned a session offer. rpc CreateSession(CreateSessionRequest) returns (Session); // UpdateSession updates the session rpc UpdateSession(UpdateSessionRequest) returns (Session); // ListSessions lists all sessions the client should consider. // // TODO: it would be better if we could alert a camera to poll for sessions // i.e., with websockets (or streaming RPCs). rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse); // CreateIceCandidate adds the provided candidate to the list of candidates. rpc CreateIceCandidate(CreateIceCandidateRequest) returns (IceCandidate); // PopIceCandidate delete a candidate from the list of candidates and returns it. // // If there are no candidates, this blocks until one becomes available. rpc PopIceCandidate(PopIceCandidateRequest) returns (IceCandidate); rpc CreateIceSessionDescription(CreateIceSessionDescriptionRequest) returns (IceSessionDescription); rpc PopIceSessionDescription(PopIceSessionDescriptionRequest) returns (IceSessionDescription); } message CreateAuthTokenRequest{ // Homes this auth token should be registered too. string home = 1; message Camera { // Used to uniquely identifier this camera so clients can open // sessions with it. string id = 1; } message Client {} oneof type { Camera camera = 2; Client client = 3; } } message ListCamerasRequest {} message ListCamerasResponse { repeated Camera cameras = 1; } message CreateSessionRequest { Session session = 1; // If true, will keep the connection alive until an update is received. // This is useful if we need to wait for a remote to detect the session // request and update it with their candidates, offer, or answer. bool wait_for_update = 2; } message UpdateSessionRequest { Session session = 1; // If true, will keep the connection alive until an update is received. // This is useful if we need to wait for a remote to detect the session // request and update it with their candidates, offer, or answer. bool wait_for_update = 2; } message ListSessionsRequest {} message ListSessionsResponse { repeated Session sessions = 1; } message CreateIceCandidateRequest { Session.Identifier session_identifier = 1; IceCandidate candidate = 2; } message PopIceCandidateRequest { Session.Identifier session_identifier = 1; } message CreateIceSessionDescriptionRequest { Session.Identifier session_identifier = 1; IceSessionDescription description = 2; } message PopIceSessionDescriptionRequest { Session.Identifier session_identifier = 1; } message Camera { message Identifier { string id = 1; } Identifier identifier = 1; } message IceCandidate { // Copied from https://pkg.go.dev/github.com/pion/webrtc/v4#ICECandidateInit string candidate = 1; optional string sdp_mid = 2; optional int32 sdp_line_index = 3; optional string username_fragment = 4; } message IceSessionDescription { // Copied from https://pkg.go.dev/github.com/pion/webrtc/v4#SessionDescription int64 sdp_type = 1; string sdp = 2; } message Session { message Identifier { string id = 1; } Identifier id = 1; Camera.Identifier camera = 2; repeated IceCandidate client_ice_candidates = 3; repeated IceCandidate camera_ice_candidates = 4; IceSessionDescription camera_offer = 5; IceSessionDescription client_answer = 6; } message AuthToken { string token = 1; }