Class: OpenVidu::Server

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/open_vidu/server.rb

Overview

Endpoint configuration

Constant Summary collapse

InvalidURI =
Class.new(StandardError)
DEFAULT_TIMEOUT =

seconds

10

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Server

‘uri` should take the form of scheme://some-openvidu-host-or-ip:port?token=<your-secret-here> e.g. 1.2.3.4?token=abcdefghijklmnop

Raises:



17
18
19
20
# File 'lib/open_vidu/server.rb', line 17

def initialize(uri)
  @uri = Addressable::URI.parse(uri.to_s)
  raise InvalidURI if @uri.empty?
end

Instance Method Details

#==(other) ⇒ Object



44
45
46
# File 'lib/open_vidu/server.rb', line 44

def ==(other)
  other.to_s == self.to_s
end

#host_and_portObject



26
27
28
# File 'lib/open_vidu/server.rb', line 26

def host_and_port
  "#{host}:#{port}"
end

#timeoutObject



36
37
38
39
40
41
42
# File 'lib/open_vidu/server.rb', line 36

def timeout
  if query_values['timeout'].to_i > 0
    query_values['timeout'].to_i
  else
    DEFAULT_TIMEOUT
  end
end

#tokenObject



22
23
24
# File 'lib/open_vidu/server.rb', line 22

def token
  "OPENVIDUAPP:#{query_values.fetch('token')}"
end

#verify_peer?Boolean

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/open_vidu/server.rb', line 30

def verify_peer?
  return false if query_values['verify_peer'].to_s.downcase == 'false'

  true
end