Class: RubyRabbitmqJanus::RRJTask

Inherits:
RRJ
  • Object
show all
Defined in:
lib/rrj/task.rb

Overview

# RubyRabbitmqJanus - Task

This class is used with rake task.

Direct Known Subclasses

RRJTaskAdmin

Instance Attribute Summary

Attributes inherited from RRJ

#session

Instance Method Summary collapse

Methods inherited from RRJ

#cleanup_connection!

Constructor Details

#initializeRRJTask

rubocop:disable Lint/MissingSuper



13
14
15
16
# File 'lib/rrj/task.rb', line 13

def initialize
  Tools::Config.instance
  Tools::Requests.instance
end

Instance Method Details

#handle_endpoint_private(options = {}) ⇒ Object

Create a transaction between Apps and Janus in queue private

:reek:FeatureEnvy

Examples:

Post a offer

options = {
  'instance' => 42,
  'session_id' => 71984735765,
  'handle_id' => 56753748917,
  'replace' => {
    'sdp' => 'v=0\r\no=[..more sdp stuff..]'
  }
}
@rrj.handle_endpoint_private(options) do |transaction|
  transaction.publish_message('peer::offer', options)
end

Since:

  • 2.7.0



76
77
78
79
80
81
82
83
84
# File 'lib/rrj/task.rb', line 76

def handle_endpoint_private(options = {})
  janus = session_instance(options)
  handle = 0 # Create always a new handle
  transaction = Janus::Transactions::Handle.new(true,
                                                janus.session,
                                                handle,
                                                janus.instance)
  transaction.connect { yield(transaction) }
end

#handle_endpoint_public(_options) ⇒ Object

For task is impossible to calling this method



48
49
50
# File 'lib/rrj/task.rb', line 48

def handle_endpoint_public(_options)
  nil
end

#session_endpoint_private(options = {}) ⇒ Object

Create a transaction between Apps and Janus in queue private

Examples:

Get Janus information

@rrj.session_endpoint_private do |transaction|
  response = transaction.publish_message('base::info').to_hash
end

Parameters:

  • options (Hash) (defaults to: {})

    Give a session number for use another session in Janus

Since:

  • 2.7.0



36
37
38
39
40
# File 'lib/rrj/task.rb', line 36

def session_endpoint_private(options = {})
  transaction = Janus::Transactions::Session.new(true,
                                                 options['session_id'])
  transaction.connect { yield(transaction) }
end

#session_endpoint_public(_options) ⇒ Object

For task is possible to calling this method, but no action is executed



43
44
45
# File 'lib/rrj/task.rb', line 43

def session_endpoint_public(_options)
  nil
end