Class: WebRTC::RTCDataChannelStats

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

Returns a new instance of RTCDataChannelStats.



174
175
176
177
178
179
180
181
182
183
184
# File 'lib/webrtc/stats_report.rb', line 174

def initialize(options = {})
  super(options.merge(type: :data_channel))
  @label = options[:label]
  @protocol = options[:protocol]
  @data_channel_identifier = options[:data_channel_identifier]
  @state = options[:state] || :connecting
  @messages_sent = options[:messages_sent] || 0
  @bytes_sent = options[:bytes_sent] || 0
  @messages_received = options[:messages_received] || 0
  @bytes_received = options[:bytes_received] || 0
end

Instance Attribute Details

#bytes_receivedObject (readonly)

Returns the value of attribute bytes_received.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def bytes_received
  @bytes_received
end

#bytes_sentObject (readonly)

Returns the value of attribute bytes_sent.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def bytes_sent
  @bytes_sent
end

#data_channel_identifierObject (readonly)

Returns the value of attribute data_channel_identifier.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def data_channel_identifier
  @data_channel_identifier
end

#labelObject (readonly)

Returns the value of attribute label.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def label
  @label
end

#messages_receivedObject (readonly)

Returns the value of attribute messages_received.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def messages_received
  @messages_received
end

#messages_sentObject (readonly)

Returns the value of attribute messages_sent.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def messages_sent
  @messages_sent
end

#protocolObject (readonly)

Returns the value of attribute protocol.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def protocol
  @protocol
end

#stateObject (readonly)

Returns the value of attribute state.



171
172
173
# File 'lib/webrtc/stats_report.rb', line 171

def state
  @state
end

Instance Method Details

#to_hObject



186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/webrtc/stats_report.rb', line 186

def to_h
  super.merge(
    label: @label,
    protocol: @protocol,
    dataChannelIdentifier: @data_channel_identifier,
    state: @state,
    messagesSent: @messages_sent,
    bytesSent: @bytes_sent,
    messagesReceived: @messages_received,
    bytesReceived: @bytes_received
  )
end