Documentation ¶
Index ¶
- type RTC
- func (r *RTC) AddLocalCandidate(candidate webrtc.ICECandidateInit)
- func (r *RTC) Destroy()
- func (r *RTC) GetAllLocalCandidates() []webrtc.ICECandidateInit
- func (r *RTC) IsConnected() bool
- func (r *RTC) Log() zerolog.Logger
- func (r *RTC) SendControlBytes(data []byte) error
- func (r *RTC) SendFrameBytes(data []byte) error
- func (r *RTC) SendMetaMessage(protobuffer proto.Message) error
- type RTCMap
- type RequestICE
- type RequestSDP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RTC ¶
type RTC struct { Id string // the id of the connection (e.g. the client id) Pc *webrtc.PeerConnection // the actual webRTC connection Candidates []webrtc.ICECandidateInit // the **local** ICE candidates (that can be transmitted to the other peers) CandidatesLock *sync.Mutex // to make sure ICE candidates can be managed concurrently // Data channels MetaChannel *webrtc.DataChannel // the data channel used to send meta information about requests made (such as requesting a video stream) ControlChannel *webrtc.DataChannel // the data channel used to send controller data (e.g. steering wheel angle) FrameChannel *webrtc.DataChannel // the data channel used to send frames with video data and other meta information (such as sensoric data) }
func (*RTC) AddLocalCandidate ¶
func (r *RTC) AddLocalCandidate(candidate webrtc.ICECandidateInit)
Add a local ICE candidate to the list of candidates fetched so far
func (*RTC) Destroy ¶
func (r *RTC) Destroy()
Destroy an RTC object and the underlying webRTC connection
func (*RTC) GetAllLocalCandidates ¶
func (r *RTC) GetAllLocalCandidates() []webrtc.ICECandidateInit
Get a copy of all local ICE candidates (concurrency-safe)
func (*RTC) IsConnected ¶
Utility function to check if the connection is still active
func (*RTC) Log ¶
Create an easy function to get a logger with the context and connection id already set
func (*RTC) SendControlBytes ¶
func (*RTC) SendFrameBytes ¶
type RTCMap ¶
type RTCMap struct {
// contains filtered or unexported fields
}
func (*RTCMap) ForEach ¶
Executes a function for each RTC connection in the map Because the RTCMap is read locked during execution, this is concurrency-safe
func (*RTCMap) UnsafeGetAll ¶
Returns a list of all RTC connections in the map. Locks when reading the map but returns a list of pointers. If you want to execute a function for each RTC connection, use ForEach instead.
type RequestICE ¶
type RequestICE struct { Candidate webrtc.ICECandidateInit `json:"candidate"` Id string `json:"id"` // to distinguish between clients }
The data format used by connecting clients (and the car) to send ICE candidates to the server
type RequestSDP ¶
type RequestSDP struct { Offer webrtc.SessionDescription `json:"offer"` Id string `json:"id"` // to distinguish between clients }
The data format used for SDP requests