Class: WebRTC::RTCTransportStats

Inherits:
RTCStats
  • Object
show all
Defined in:
lib/webrtc/stats_report.rb

Constant Summary

Constants inherited from RTCStats

WebRTC::RTCStats::TYPES

Instance Attribute Summary collapse

Attributes inherited from RTCStats

#id, #timestamp, #type

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RTCTransportStats

Returns a new instance of RTCTransportStats.



135
136
137
138
139
140
141
# File 'lib/webrtc/stats_report.rb', line 135

def initialize(options = {})
  super(options.merge(type: :transport))
  @bytes_sent = options[:bytes_sent] || 0
  @bytes_received = options[:bytes_received] || 0
  @dtls_state = options[:dtls_state] || :new
  @selected_candidate_pair_id = options[:selected_candidate_pair_id]
end

Instance Attribute Details

#bytes_receivedObject (readonly)

Returns the value of attribute bytes_received.



133
134
135
# File 'lib/webrtc/stats_report.rb', line 133

def bytes_received
  @bytes_received
end

#bytes_sentObject (readonly)

Returns the value of attribute bytes_sent.



133
134
135
# File 'lib/webrtc/stats_report.rb', line 133

def bytes_sent
  @bytes_sent
end

#dtls_stateObject (readonly)

Returns the value of attribute dtls_state.



133
134
135
# File 'lib/webrtc/stats_report.rb', line 133

def dtls_state
  @dtls_state
end

#selected_candidate_pair_idObject (readonly)

Returns the value of attribute selected_candidate_pair_id.



133
134
135
# File 'lib/webrtc/stats_report.rb', line 133

def selected_candidate_pair_id
  @selected_candidate_pair_id
end

Instance Method Details

#to_hObject



143
144
145
146
147
148
149
150
# File 'lib/webrtc/stats_report.rb', line 143

def to_h
  super.merge(
    bytesSent: @bytes_sent,
    bytesReceived: @bytes_received,
    dtlsState: @dtls_state,
    selectedCandidatePairId: @selected_candidate_pair_id
  )
end