ruby_rabbitmq_janus 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +19 -2
- data/lib/rrj/info.rb +8 -6
- data/lib/rrj/init.rb +15 -7
- data/lib/rrj/janus/transactions/handle.rb +8 -4
- metadata +8 -8
- data/listen.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd08f2f0ae315d6330ae87407c249c8de25bb55
|
4
|
+
data.tar.gz: 12a22014d95a64e3231d1ac9de1c36b4eb4d263a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 619529b2da03ed8582cb91b4009894dbfbf5cf4f4d45f8d91fda3b7e392326ac33285dbf4df3b2bb45988695875085945ce9322ddcd77760a6cd0536c93499ca
|
7
|
+
data.tar.gz: 4e15f89cb74a0b0574ec06bc518fe5e8c6393d3c68b5aefaaeaee501369f2dc0c37ccbd9a0b6204d928aaa4aa24cfc21e10da5ff1498beb448a88a0b4ee56078
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
|
9
|
+
## [1.1.8] - 2016-11-29
|
10
|
+
### Changed
|
11
|
+
- Return handle created with start_handle method
|
12
|
+
- Complete info in README.md
|
13
|
+
- Change metrics length
|
14
|
+
### Deleted
|
15
|
+
- Delete a test script `listen.rb`
|
16
|
+
|
8
17
|
## [1.1.7] - 2016-11-28
|
9
18
|
### Changed
|
10
19
|
- Use handle if is given in arguments for handle_message_simple
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ruby-rabbitmq-janus
|
1
|
+
# ruby-rabbitmq-janus -- RRJ
|
2
2
|
Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
|
3
3
|
|
4
4
|
This gem is used to communicate to a server Janus through RabbitMQ software (
|
@@ -6,6 +6,9 @@ Message-oriented middleware). It waiting a messages to Rails API who send to Rab
|
|
6
6
|
server in a queue for janus server. janus processes a message and send to RabbitMQ server
|
7
7
|
in a queue for gem. Once the received message is decoded and returned through the Rails API.
|
8
8
|
|
9
|
+
|
10
|
+
This gem is product by [Dazzl.tv](http://dazzl.tv)
|
11
|
+
|
9
12
|
## Menu
|
10
13
|
* [How to use](#how-to-use)
|
11
14
|
* [Installation](#installation)
|
@@ -14,9 +17,12 @@ in a queue for gem. Once the received message is decoded and returned through th
|
|
14
17
|
* [Usage Synchrounous](#usage-with-synchronous-request)
|
15
18
|
* [Usage Asynchrounous](#usage-with-asynchronous-request)
|
16
19
|
* [Aliases](#aliases)
|
20
|
+
* [Upgrade](#upgrade)
|
17
21
|
* [Development](#development)
|
18
22
|
* [RSpec](#rspec-test)
|
19
23
|
* [Documentation](#documentation)
|
24
|
+
* [Read documentation](#read-documentation)
|
25
|
+
* [Generate developer documentation](#generate-developer-documentation)
|
20
26
|
|
21
27
|
## How to use
|
22
28
|
|
@@ -122,6 +128,7 @@ message_template_ask_async => ask_async
|
|
122
128
|
```
|
123
129
|
|
124
130
|
## Development
|
131
|
+
|
125
132
|
### RSpec test
|
126
133
|
|
127
134
|
```linux
|
@@ -146,8 +153,18 @@ Use tags for rspec :
|
|
146
153
|
| | log |
|
147
154
|
| | config |
|
148
155
|
|
156
|
+
## Upgrade
|
157
|
+
|
158
|
+
For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
|
159
|
+
|
149
160
|
### Documentation
|
150
161
|
|
162
|
+
#### Read documentation
|
163
|
+
|
164
|
+
The documentation is accessible in [rubydoc](http://www.rubydoc.info/gems/ruby_rabbitmq_janus/)
|
165
|
+
|
166
|
+
#### Generate developer documentation
|
167
|
+
|
151
168
|
This doc is generated with yard.
|
152
169
|
|
153
170
|
```
|
@@ -157,4 +174,4 @@ yard
|
|
157
174
|
yard server
|
158
175
|
```
|
159
176
|
|
160
|
-
|
177
|
+
[See Yard Getting Started](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
data/lib/rrj/info.rb
CHANGED
@@ -3,17 +3,19 @@
|
|
3
3
|
# Define constant to gem.
|
4
4
|
module RubyRabbitmqJanus
|
5
5
|
# Define version to gem
|
6
|
-
VERSION = '1.1.
|
6
|
+
VERSION = '1.1.8'
|
7
7
|
|
8
8
|
# Define a summary description to gem
|
9
9
|
SUMMARY = 'Ruby RabbitMQ Janus'
|
10
10
|
|
11
11
|
# Define a long description to gem
|
12
|
-
DESCRIPTION =
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
DESCRIPTION = <<-DESC
|
13
|
+
This gem is used to communicate to a server Janus through RabbitMQ software
|
14
|
+
(Message-oriented middleware). It waiting a messages to Rails API who send to
|
15
|
+
RabbitMQ server in a queue for janus server. Janus processes a message and send
|
16
|
+
to RabbitMQ server in a queue for gem. Once the received message is decoded and
|
17
|
+
returned through the Rails API.
|
18
|
+
DESC
|
17
19
|
|
18
20
|
# Define homepage
|
19
21
|
HOMEPAGE = 'https://github.com/dazzl-tv/ruby-rabbitmq-janus'
|
data/lib/rrj/init.rb
CHANGED
@@ -13,9 +13,12 @@ require 'colorize'
|
|
13
13
|
|
14
14
|
module RubyRabbitmqJanus
|
15
15
|
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
16
|
-
# Initialize gem and create automatically
|
16
|
+
# Initialize RRJ gem and create automatically a session with janus and
|
17
|
+
# sending a keepalive message. The Time To Live is configured in yaml
|
18
|
+
# configuration file 'config/default.yml' or
|
19
|
+
# 'config/ruby-rabbitmq-janus.yml'.
|
17
20
|
# @!attribute [r] session
|
18
|
-
# @return [Fixnum]
|
21
|
+
# @return [Fixnum] Return an session number created in instantiate this gem.
|
19
22
|
# :reek:BooleanParameter and :reek:ControlParameter and :reek:DataClump
|
20
23
|
# :reek:LongParameterList and :reek:TooManyStatements
|
21
24
|
class RRJ
|
@@ -81,7 +84,8 @@ module RubyRabbitmqJanus
|
|
81
84
|
# Give an object response to janus server
|
82
85
|
def message_admin(type, options = {})
|
83
86
|
Janus::Transactions::Admin.new(@session).connect do
|
84
|
-
Janus::Messages::Admin.new(type,
|
87
|
+
Janus::Messages::Admin.new(type,
|
88
|
+
options.merge!('session_id' => @session))
|
85
89
|
end
|
86
90
|
end
|
87
91
|
|
@@ -122,8 +126,8 @@ module RubyRabbitmqJanus
|
|
122
126
|
end
|
123
127
|
|
124
128
|
# Start an short transaction. Create an handle and send a message to queue.
|
125
|
-
# This queue is not exclusive, so this message is sending in queue
|
126
|
-
# response is return in queue 'from-janus'
|
129
|
+
# This queue is not exclusive, so this message is sending in queue
|
130
|
+
# 'to-janus' and a response is return in queue 'from-janus'
|
127
131
|
# @example Send an request trickle
|
128
132
|
# candidate = {
|
129
133
|
# 'candidate' => {
|
@@ -132,8 +136,12 @@ module RubyRabbitmqJanus
|
|
132
136
|
# 'candidate' => '...'
|
133
137
|
# }
|
134
138
|
# }
|
135
|
-
# RubyRabbitmqJanus::RRJ.new.handle_message_simple('peer::trickle',
|
136
|
-
#
|
139
|
+
# RubyRabbitmqJanus::RRJ.new.handle_message_simple('peer::trickle',
|
140
|
+
# candidate)
|
141
|
+
# #=> { 'janus' => 'trickle', ..., 'candidate' => {
|
142
|
+
# 'completed' : true
|
143
|
+
# }
|
144
|
+
# }
|
137
145
|
def handle_message_simple(type, replace = {}, add = {}, exclusive = false)
|
138
146
|
handle = replace.include?('handle_id') ? replace['handle_id'] : 0
|
139
147
|
@transaction = Janus::Transactions::Handle.new(@session)
|
@@ -21,10 +21,11 @@ module RubyRabbitmqJanus
|
|
21
21
|
create_handle
|
22
22
|
yield
|
23
23
|
end
|
24
|
+
handle
|
24
25
|
end
|
25
26
|
|
26
|
-
# Initialize connection to Rabbit and Janus and close after sending an
|
27
|
-
# a response
|
27
|
+
# Initialize connection to Rabbit and Janus and close after sending an
|
28
|
+
# received a response
|
28
29
|
def handle_connect_and_stop(exclusive, sender)
|
29
30
|
@exclusive = exclusive
|
30
31
|
rabbit.transaction_short do
|
@@ -52,7 +53,8 @@ module RubyRabbitmqJanus
|
|
52
53
|
# Create an handle for transaction
|
53
54
|
def create_handle
|
54
55
|
Tools::Log.instance.info 'Create an handle'
|
55
|
-
|
56
|
+
opt = { 'session_id' => session }
|
57
|
+
msg = Janus::Messages::Standard.new('base::attach', opt)
|
56
58
|
@handle = send_a_message_exclusive { msg }
|
57
59
|
end
|
58
60
|
|
@@ -64,7 +66,9 @@ module RubyRabbitmqJanus
|
|
64
66
|
|
65
67
|
# Send a messaeg in exclusive queue
|
66
68
|
def send_a_message_exclusive
|
67
|
-
Janus::Responses::Standard.new(read_response_exclusive
|
69
|
+
Janus::Responses::Standard.new(read_response_exclusive do
|
70
|
+
yield
|
71
|
+
end).sender
|
68
72
|
end
|
69
73
|
|
70
74
|
# Read an response in queue exclusive
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rabbitmq_janus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VAILLANT Jeremy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -292,11 +292,12 @@ dependencies:
|
|
292
292
|
- - "~>"
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: 0.8.1
|
295
|
-
description:
|
296
|
-
|
297
|
-
|
298
|
-
server in a queue for
|
299
|
-
the
|
295
|
+
description: |
|
296
|
+
This gem is used to communicate to a server Janus through RabbitMQ software
|
297
|
+
(Message-oriented middleware). It waiting a messages to Rails API who send to
|
298
|
+
RabbitMQ server in a queue for janus server. Janus processes a message and send
|
299
|
+
to RabbitMQ server in a queue for gem. Once the received message is decoded and
|
300
|
+
returned through the Rails API.
|
300
301
|
email:
|
301
302
|
- jeremy.vaillant@dazzl.tv
|
302
303
|
executables: []
|
@@ -373,7 +374,6 @@ files:
|
|
373
374
|
- lib/rrj/tools/requests.rb
|
374
375
|
- lib/rrj/tools/tools.rb
|
375
376
|
- lib/ruby_rabbitmq_janus.rb
|
376
|
-
- listen.rb
|
377
377
|
- rrj.gemspec
|
378
378
|
homepage: https://github.com/dazzl-tv/ruby-rabbitmq-janus
|
379
379
|
licenses:
|
data/listen.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'ruby_rabbitmq_janus'
|
5
|
-
|
6
|
-
@t = RubyRabbitmqJanus::RRJ.new
|
7
|
-
@e = RubyRabbitmqJanus::Janus::Concurrencies::Event.instance
|
8
|
-
|
9
|
-
def case_event(response)
|
10
|
-
puts "REASON : Event : #{response.to_hash}"
|
11
|
-
end
|
12
|
-
|
13
|
-
def case_hangup(data)
|
14
|
-
puts "REASON : Hangup : #{data}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def case_error(data)
|
18
|
-
puts "REASON : Error : #{data}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def case_stop
|
22
|
-
puts 'REASON : Stop'
|
23
|
-
Thread.current.stop
|
24
|
-
end
|
25
|
-
|
26
|
-
events = lambda do |reason, response|
|
27
|
-
puts "Execute block code with reason : #{reason}"
|
28
|
-
case reason
|
29
|
-
when 'event' then case_event(response)
|
30
|
-
when 'hangup' then case_hangup(response)
|
31
|
-
when 'error' then case_error(response)
|
32
|
-
when 'stop' then case_stop
|
33
|
-
else
|
34
|
-
puts 'REASON default'
|
35
|
-
end
|
36
|
-
puts " --\n\r"
|
37
|
-
end
|
38
|
-
|
39
|
-
puts '## Start listen Block'
|
40
|
-
@e.run(&events)
|
41
|
-
puts '## End listen block'
|
42
|
-
|
43
|
-
puts '## APPS RUNNING'
|
44
|
-
loop do
|
45
|
-
end
|