Class: WebRTC::RTCSctpTransport

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

Constant Summary collapse

STATES =
%i[connecting connected closed].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RTCSctpTransport

Returns a new instance of RTCSctpTransport.



9
10
11
12
13
14
15
16
# File 'lib/webrtc/sctp_transport.rb', line 9

def initialize(options = {})
  @transport = options[:transport] || RTCDtlsTransport.new
  @state = :connecting
  @max_message_size = options[:max_message_size] || 262_144
  @max_channels = options[:max_channels] || 65_535
  @callbacks = {}
  @ptr = options[:ptr]
end

Instance Attribute Details

#max_channelsObject (readonly)

Returns the value of attribute max_channels.



7
8
9
# File 'lib/webrtc/sctp_transport.rb', line 7

def max_channels
  @max_channels
end

#max_message_sizeObject (readonly)

Returns the value of attribute max_message_size.



7
8
9
# File 'lib/webrtc/sctp_transport.rb', line 7

def max_message_size
  @max_message_size
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/webrtc/sctp_transport.rb', line 7

def state
  @state
end

#transportObject (readonly)

Returns the value of attribute transport.



7
8
9
# File 'lib/webrtc/sctp_transport.rb', line 7

def transport
  @transport
end

Instance Method Details

#on_state_change(&block) ⇒ Object



18
19
20
# File 'lib/webrtc/sctp_transport.rb', line 18

def on_state_change(&block)
  @callbacks[:state_change] = block
end