Class: WebRTC::RTCPeerConnectionStats

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 = {}) ⇒ RTCPeerConnectionStats

Returns a new instance of RTCPeerConnectionStats.



156
157
158
159
160
# File 'lib/webrtc/stats_report.rb', line 156

def initialize(options = {})
  super(options.merge(type: :peer_connection))
  @data_channels_opened = options[:data_channels_opened] || 0
  @data_channels_closed = options[:data_channels_closed] || 0
end

Instance Attribute Details

#data_channels_closedObject (readonly)

Returns the value of attribute data_channels_closed.



154
155
156
# File 'lib/webrtc/stats_report.rb', line 154

def data_channels_closed
  @data_channels_closed
end

#data_channels_openedObject (readonly)

Returns the value of attribute data_channels_opened.



154
155
156
# File 'lib/webrtc/stats_report.rb', line 154

def data_channels_opened
  @data_channels_opened
end

Instance Method Details

#to_hObject



162
163
164
165
166
167
# File 'lib/webrtc/stats_report.rb', line 162

def to_h
  super.merge(
    dataChannelsOpened: @data_channels_opened,
    dataChannelsClosed: @data_channels_closed
  )
end