Sha256: 14f5bf3ad9e3fc360634bb88cc705fe1fa070930b585a2b7de4db345c3d8d215

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'ruby_rabbitmq_janus'

@t = RubyRabbitmqJanus::RRJ.new
@e = RubyRabbitmqJanus::Janus::Concurrencies::Event.instance

# :reek:NilCheck and :reek:TooManyStatements
def case_event(data, jsep)
  puts "REASON : Event : #{data.class} -- #{data}"
  case data['videocontrol']
  when 'joined'
    puts 'Joined request ...'
    @t.handle_message_simple('channel::offer', jsep)
  end
  update_jsep(jsep) unless jsep.nil?
end

def update_jsep(jsep)
  puts "JSEP : #{jsep}"
end

def case_stop
  puts 'REASON : Stop'
  Thread.current.stop
end

events = lambda do |reason, data = nil, jsep = nil|
  puts "Execute block code with reason : #{reason}"
  case reason
  when 'event' then case_event(data, jsep)
  when 'stop' then case_stop
  else
    puts 'REASON default'
  end
end

puts '## Start listen Block'
@e.run(&events)
puts '## End listen block'

puts '## APPS RUNNING'
loop do
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-1.1.1 listen.rb
ruby_rabbitmq_janus-1.1.0 listen.rb
ruby_rabbitmq_janus-1.0.8 listen.rb
ruby_rabbitmq_janus-1.0.7 listen.rb
ruby_rabbitmq_janus-1.0.6 listen.rb