ruby_rabbitmq_janus 1.2.9 → 2.0.0.pre.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +145 -32
- data/config/default.yml +2 -0
- data/config/requests.md +2 -1
- data/config/requests/admin/add_token.json +6 -0
- data/config/requests/admin/allow_token.json +6 -0
- data/config/requests/admin/disallow_token.json +6 -0
- data/config/requests/admin/handle_info.json +1 -1
- data/config/requests/admin/handles.json +1 -1
- data/config/requests/admin/remove_token.json +6 -0
- data/config/requests/admin/sessions.json +1 -1
- data/config/requests/admin/set_locking_debug.json +6 -0
- data/config/requests/admin/{log_level.json → set_log_level.json} +1 -1
- data/config/requests/admin/tokens.json +5 -0
- data/config/requests/base/attach.json +1 -1
- data/config/requests/base/create.json +1 -1
- data/config/requests/base/destroy.json +1 -1
- data/config/requests/base/detach.json +1 -1
- data/config/requests/base/info.json +1 -1
- data/config/requests/base/keepalive.json +1 -1
- data/config/requests/peer/answer.json +1 -1
- data/config/requests/peer/offer.json +1 -1
- data/config/requests/peer/trickle.json +1 -1
- data/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +3 -0
- data/lib/rrj/admin.rb +34 -0
- data/lib/rrj/errors/error.rb +2 -1
- data/lib/rrj/errors/init.rb +6 -0
- data/lib/rrj/errors/janus/janus.rb +1 -0
- data/lib/rrj/errors/janus/janus_message.rb +8 -4
- data/lib/rrj/errors/janus/janus_processus_keepalive.rb +1 -0
- data/lib/rrj/errors/janus/janus_response.rb +27 -6
- data/lib/rrj/errors/janus/janus_transaction.rb +4 -0
- data/lib/rrj/errors/rabbit/rabbit.rb +3 -1
- data/lib/rrj/errors/tools/config.rb +1 -0
- data/lib/rrj/info.rb +1 -1
- data/lib/rrj/init.rb +37 -169
- data/lib/rrj/janus/messages/admin.rb +1 -2
- data/lib/rrj/janus/messages/message.rb +4 -4
- data/lib/rrj/janus/messages/standard.rb +3 -5
- data/lib/rrj/janus/processus/concurrency.rb +1 -1
- data/lib/rrj/janus/processus/keepalive.rb +10 -4
- data/lib/rrj/janus/responses/admin.rb +31 -0
- data/lib/rrj/janus/responses/event.rb +23 -5
- data/lib/rrj/janus/responses/response.rb +2 -0
- data/lib/rrj/janus/responses/standard.rb +26 -5
- data/lib/rrj/janus/transactions/admin.rb +22 -26
- data/lib/rrj/janus/transactions/handle.rb +13 -8
- data/lib/rrj/janus/transactions/session.rb +25 -7
- data/lib/rrj/janus/transactions/transaction.rb +2 -1
- data/lib/rrj/rabbit/connect.rb +2 -3
- data/lib/rrj/rabbit/publish/admin.rb +1 -6
- data/lib/rrj/rabbit/publish/base_publisher.rb +6 -11
- data/lib/rrj/rabbit/publish/exclusive.rb +1 -0
- data/lib/rrj/rabbit/publish/listener.rb +10 -27
- data/lib/rrj/rabbit/publish/non_exclusive.rb +2 -6
- data/lib/rrj/rabbit/publish/publisher.rb +4 -17
- data/lib/rrj/tools/{config.rb → gem/config.rb} +5 -5
- data/lib/rrj/tools/{log.rb → gem/log.rb} +21 -6
- data/lib/rrj/tools/gem/option.rb +57 -0
- data/lib/rrj/tools/{requests.rb → gem/requests.rb} +0 -0
- data/lib/rrj/tools/replaces/admin.rb +7 -13
- data/lib/rrj/tools/replaces/handle.rb +61 -0
- data/lib/rrj/tools/replaces/replace.rb +57 -27
- data/lib/rrj/tools/replaces/session.rb +34 -0
- data/lib/rrj/tools/replaces/type.rb +63 -11
- data/lib/rrj/tools/tools.rb +4 -3
- data/lib/ruby_rabbitmq_janus.rb +1 -0
- data/spec/request/admin/request_handle_info_spec.rb +13 -7
- data/spec/request/admin/request_handles_spec.rb +20 -0
- data/spec/request/admin/request_sessions_spec.rb +5 -4
- data/spec/request/admin/request_set_locking_debug_spec.rb +16 -0
- data/spec/request/admin/request_set_log_level_spec.rb +16 -0
- data/spec/request/admin/request_tokens_spec.rb +13 -0
- data/spec/request/base/request_attach_spec.rb +6 -9
- data/spec/request/base/request_create_spec.rb +5 -3
- data/spec/request/base/request_destroy_spec.rb +5 -3
- data/spec/request/base/request_detach_spec.rb +6 -7
- data/spec/request/base/request_info_spec.rb +5 -3
- data/spec/request/base/request_keepalive_spec.rb +5 -3
- data/spec/request/peer/request_offer_spec.rb +18 -92
- data/spec/request/peer/request_trickle_spec.rb +9 -28
- data/spec/request/peer/request_trickles_spec.rb +23 -0
- data/spec/rrj/responses/responses_admin_spec.rb +39 -0
- data/spec/rrj/responses/responses_event_spec.rb +25 -0
- data/spec/rrj/responses/responses_response_spec.rb +31 -0
- data/spec/rrj/responses/responses_standard_spec.rb +43 -0
- data/spec/rrj/rrj_config_spec.rb +7 -7
- data/spec/rrj/rrj_rabbitmq_spec.rb +1 -1
- data/spec/rrj/tools/replace_admin_spec.rb +86 -0
- data/spec/rrj/tools/replace_handle_spec.rb +78 -0
- data/spec/rrj/tools/replace_session_spec.rb +66 -0
- data/spec/rrj/tools/replace_spec.rb +69 -0
- data/spec/rrj/tools/type_spec.rb +150 -0
- data/spec/spec_helper.rb +46 -7
- data/spec/support/examples_request.rb +33 -61
- data/spec/support/examples_response.rb +30 -0
- data/spec/support/schemas/request/admin/handles.json +15 -0
- data/spec/support/schemas/request/admin/set_locking_debug.json +13 -0
- data/spec/support/schemas/request/admin/set_log_level.json +11 -0
- data/spec/support/schemas/request/admin/tokens.json +13 -0
- data/spec/support/type.rb +66 -0
- metadata +41 -69
- data/config/requests/peer/trickles.json +0 -7
- data/lib/rrj/tools/replaces/standard.rb +0 -101
- data/spec/fixtures/config/requests/admin/handle_info.json +0 -3
- data/spec/fixtures/config/requests/admin/handles.json +0 -3
- data/spec/fixtures/config/requests/admin/log_level.json +0 -3
- data/spec/fixtures/config/requests/admin/sessions.json +0 -3
- data/spec/fixtures/config/requests/base/attach.json +0 -3
- data/spec/fixtures/config/requests/base/create.json +0 -4
- data/spec/fixtures/config/requests/base/destroy.json +0 -3
- data/spec/fixtures/config/requests/base/detach.json +0 -3
- data/spec/fixtures/config/requests/base/info.json +0 -3
- data/spec/fixtures/config/requests/base/keepalive.json +0 -3
- data/spec/fixtures/config/requests/peer/answer.json +0 -3
- data/spec/fixtures/config/requests/peer/offer.json +0 -3
- data/spec/fixtures/config/requests/peer/trickle.json +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1558392e819c90c47f344453a5cb2c3a35a736e
|
4
|
+
data.tar.gz: ea73603197dbeaa4a66cc9944878bda5a87f0f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c17fddb071389955d91bff722fa07724789ccc4442e7867408a5311b6e718b02fcb6893b44ca365856be06706d8597c1cbbf85ae8b1f8bc3b1a1cf6ee1532ce9
|
7
|
+
data.tar.gz: 0daeb4638c093421bda626bc56cb70e4f1985753010d78a559838875df816796333486c58500f3b767f5bc4e0a1c72334ada87a677b1b9026e24b9cc208386df
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus)
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus)
|
3
|
-
[![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
|
4
|
-
|
5
|
-
# ruby-rabbitmq-janus -- RRJ
|
1
|
+
# Ruby RabbitMQ Janus | [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus) [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus) [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
|
6
2
|
|
7
3
|
Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
|
8
4
|
|
@@ -14,29 +10,73 @@ RabbitMQ server in a queue for janus server. janus processes a message and send
|
|
14
10
|
|
15
11
|
This gem is product by [Dazzl.tv](http://dazzl.tv)
|
16
12
|
|
13
|
+
```linux
|
14
|
+
------------ ---------- -------
|
15
|
+
|Rails Apps| |RabbitMQ| |Janus|
|
16
|
+
------------ ---------- -------
|
17
|
+
| | |
|
18
|
+
| Request : { "janus": "info" } | |
|
19
|
+
| --------------------------------> | |
|
20
|
+
| Create request json. | |
|
21
|
+
| Sending in queue. | |
|
22
|
+
| | -----------------------------> |
|
23
|
+
| | Read a message in queue | ----- |
|
24
|
+
| | | | Return a response
|
25
|
+
| | | | to treatment executed.
|
26
|
+
| | | <---- |
|
27
|
+
| | |
|
28
|
+
| | |
|
29
|
+
| | <---------------------------- |
|
30
|
+
| <-------------------------------- | |
|
31
|
+
| | |
|
32
|
+
| | |
|
33
|
+
| | |
|
34
|
+
| | |
|
35
|
+
```
|
36
|
+
|
17
37
|
## Menu
|
38
|
+
|
18
39
|
* [How to use](#how-to-use)
|
19
|
-
|
20
|
-
|
40
|
+
* [Installation](#installation)
|
41
|
+
* [Configuration](#configuration)
|
21
42
|
* [Generators](#generators)
|
22
43
|
* [Requests](#requests)
|
23
|
-
|
44
|
+
* [Usage](#usage)
|
45
|
+
* [Information](#usage-information)
|
46
|
+
* [Standard request](#standard-request)
|
47
|
+
* [Admin request](#admin-request)
|
48
|
+
* [Listen Janus Event](#listen-janus-event)
|
24
49
|
* [Upgrade](#upgrade)
|
25
50
|
* [Development](#development)
|
26
|
-
|
27
|
-
|
51
|
+
* [RSpec](#rspec-test)
|
52
|
+
* [Documentation](#documentation)
|
28
53
|
* [Read documentation](#read-documentation)
|
29
54
|
* [Generate developer documentation](#generate-developer-documentation)
|
55
|
+
* [Contributing](#contributing)
|
56
|
+
* [Plus](#plus)
|
30
57
|
|
31
58
|
## How to use
|
32
59
|
|
33
60
|
### Installation
|
34
61
|
|
35
|
-
Use rubygem for installing gem in your application. Add in your Gemfile
|
62
|
+
Use rubygem for installing gem in your application. Add in your Gemfile :
|
63
|
+
|
36
64
|
```ruby
|
37
65
|
gem 'ruby_rabbitmq_janus'
|
38
66
|
```
|
39
67
|
|
68
|
+
And then execute :
|
69
|
+
|
70
|
+
```linux
|
71
|
+
bundle
|
72
|
+
```
|
73
|
+
|
74
|
+
Or install it yourself as :
|
75
|
+
|
76
|
+
```linux
|
77
|
+
gem install evostream-event
|
78
|
+
```
|
79
|
+
|
40
80
|
### Configuration
|
41
81
|
|
42
82
|
If you want used a customize configuration see [ruby-rabbitmq-janus.yml](config/default.md)
|
@@ -68,8 +108,61 @@ For more explain in requests files see [default requests](config/requests.md).
|
|
68
108
|
|
69
109
|
### Usage
|
70
110
|
|
111
|
+
#### Usage information
|
112
|
+
|
113
|
+
This gem use rabbitmq for manage request sending to Janus, so see
|
114
|
+
[documentation Janus](https://janus.conf.meetecho.com/docs/pages.html) and
|
115
|
+
[documentation Rabbitmq](http://www.rabbitmq.com/documentation.html). This gem
|
116
|
+
use bunny gem for create connection with rabbitmq. See many guide :
|
117
|
+
[bunny documentation](http://rubybunny.info/articles/guides.html).
|
118
|
+
|
119
|
+
#### Standard Request
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
require 'ruby_rabbitmq_janus'
|
123
|
+
|
124
|
+
# Initialize standard object
|
125
|
+
t = RubyRabbitmqJanus::RRJ.new
|
126
|
+
|
127
|
+
# Ask info Janus Instance
|
128
|
+
t.start_transaction do |transaction|
|
129
|
+
transaction.publish_message('base::info')
|
130
|
+
end
|
131
|
+
|
132
|
+
=> @request={"janus"=>"server_info" ... }
|
133
|
+
```
|
134
|
+
|
135
|
+
#### Admin Request
|
71
136
|
|
72
|
-
|
137
|
+
```ruby
|
138
|
+
require 'ruby_rabbitmq_janus'
|
139
|
+
|
140
|
+
# Initialize admin object
|
141
|
+
t = RubyRabbitmqJanus::RRJAdmin.new
|
142
|
+
|
143
|
+
# Ask info sessions in Janus Instance
|
144
|
+
t.start_transaction_admin do |transaction|
|
145
|
+
transaction.publish_message('admin::sessions')
|
146
|
+
end
|
147
|
+
|
148
|
+
=> @request={"janus"=>"success" ... "sessions"=>[123, 456, 789]}
|
149
|
+
```
|
150
|
+
|
151
|
+
#### Listen Janus Event
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
require 'ruby_rabbitmq_janus'
|
155
|
+
|
156
|
+
# Create a class in your Rails application
|
157
|
+
actions = RubyRabbitmqJanus::ActionEvents.new.action
|
158
|
+
|
159
|
+
# Initialize a thread for listen public queue and send class to thread
|
160
|
+
RubyRabbitmqJanus::Janus::Concurrencies::Event.instance.run(@actions)
|
161
|
+
```
|
162
|
+
|
163
|
+
## Upgrade
|
164
|
+
|
165
|
+
For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
|
73
166
|
|
74
167
|
## Development
|
75
168
|
|
@@ -84,32 +177,40 @@ rabbitmq and use plugin echotest for janus server.
|
|
84
177
|
|
85
178
|
Use tags for rspec :
|
86
179
|
|
87
|
-
| Describe | Type | Name
|
88
|
-
| ------------------------------------------------------------- | --------------- | ---------------
|
89
|
-
| **Internaly function** | config |
|
90
|
-
| Use bunny gem | | rabbit
|
91
|
-
| Test log functions | | log
|
92
|
-
| Test configuration function | | config
|
93
|
-
| Test Gem contains CONSTANTS | | describe
|
94
|
-
| **Level request sending to janus (admin monitor API or classic)** | level |
|
95
|
-
| Request with no admin right. | | base
|
96
|
-
| Request with admin right in Janus application. | | admin
|
97
|
-
|
|
98
|
-
|
|
99
|
-
| Test request type
|
100
|
-
| Test request type
|
101
|
-
| Test request type
|
102
|
-
| Test request type
|
180
|
+
| Describe | Type | Name |
|
181
|
+
| ------------------------------------------------------------- | --------------- | --------------- |
|
182
|
+
| **Internaly function** | config | |
|
183
|
+
| Use bunny gem | | rabbit |
|
184
|
+
| Test log functions | | log |
|
185
|
+
| Test configuration function | | config |
|
186
|
+
| Test Gem contains CONSTANTS | | describe |
|
187
|
+
| **Level request sending to janus (admin monitor API or classic)** | level | |
|
188
|
+
| Request with no admin right. | | base |
|
189
|
+
| Request with admin right in Janus application. | | admin |
|
190
|
+
| Request candidate/jsep | | peer |
|
191
|
+
| **Request JSON sending to Rabbitmq -> Janus** | request | |
|
192
|
+
| Test request attach type | | attach |
|
193
|
+
| Test request type create | | create |
|
194
|
+
| Test request type detach | | detach |
|
195
|
+
| Test request type janus info | | info |
|
196
|
+
| Test request type test | | test |
|
197
|
+
| Test request type handle list | | handles |
|
198
|
+
| Test request type sesssion list | | sessions |
|
199
|
+
| Test request type handle information | | handle_info |
|
200
|
+
| Test request type (un)locking debug | | set_locking_debug |
|
201
|
+
| Test request type change log level | | set_log_level |
|
202
|
+
| ~~Test request type tokens list~~ | | tokens |
|
203
|
+
| Test request type destroy session | | destroy |
|
204
|
+
| Test request keepalive | | keepalive |
|
205
|
+
| ~~Test request type sdp offer~~ | | offer |
|
206
|
+
| Test request type trickle, send on candidate | | trickle |
|
207
|
+
| Test request type trickles, send array candidate | | trickles |
|
103
208
|
|
104
209
|
Example usage rspec with tags :
|
105
210
|
```ruby
|
106
211
|
rspec --tag --name:config --tag level:base
|
107
212
|
```
|
108
213
|
|
109
|
-
## Upgrade
|
110
|
-
|
111
|
-
For upgrade your application read [CHANGELOG.md](CHANGELOG.md)
|
112
|
-
|
113
214
|
### Documentation
|
114
215
|
|
115
216
|
#### Read documentation
|
@@ -128,3 +229,15 @@ yard server
|
|
128
229
|
```
|
129
230
|
|
130
231
|
[See Yard Getting Started](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
232
|
+
|
233
|
+
## Contributing
|
234
|
+
|
235
|
+
Bug reports and pull requests are welcome on GitHub at
|
236
|
+
https://github.com/dazzl-tv/ruby-rabbitmq-janus This project is intended to be a
|
237
|
+
safe, welcoming space for collaboration, and contributors are expected to adhere
|
238
|
+
to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
239
|
+
|
240
|
+
## Plus
|
241
|
+
|
242
|
+
Janus Admin Monitor project use this gem for manage data in Janus Meetecho with
|
243
|
+
Admin/Monitor API.
|
data/config/default.yml
CHANGED
data/config/requests.md
CHANGED
@@ -53,7 +53,8 @@ Some fields are customizables. For this fields is a gem to apply a transformatio
|
|
53
53
|
|
54
54
|
Each fields use an type :
|
55
55
|
|
56
|
-
* "\<number\>" - Is
|
56
|
+
* "\<number\>" - Is a integer
|
57
|
+
* "\<number\>" - Is a integer
|
57
58
|
* "\<string\>" - Is a string
|
58
59
|
* "\<plugin[X]\>" - Is a plugin with X is a key to array in config file
|
59
60
|
* "\<array\>" - Is a array. If array contains a single value is transform to string format.
|
@@ -13,6 +13,9 @@ require 'actions'
|
|
13
13
|
# Initialize a gem and create an session with a keepalive
|
14
14
|
::RRJ = RubyRabbitmqJanus::RRJ.new
|
15
15
|
|
16
|
+
# For admin management
|
17
|
+
# ::RRJ = RubyRabbitmqJanus::RRJAdmin.new
|
18
|
+
|
16
19
|
# This test disable this gems execution when you running an task with rake
|
17
20
|
unless File.basename($PROGRAM_NAME) == 'rake'
|
18
21
|
Rails.configuration.after_initialize do
|
data/lib/rrj/admin.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
5
|
+
|
6
|
+
# # RubyRabbitmqJanus - RRJAdmin
|
7
|
+
#
|
8
|
+
# This class inherite to a classic initializer but it's used for
|
9
|
+
# admin request sending to janus (Admin/Monitor API).
|
10
|
+
#
|
11
|
+
# **Is used just for sending a message to Janus Monitor/Admin API.**.
|
12
|
+
# **The queue is always ***exclusive*** for not transmitting data to
|
13
|
+
# anyone.**
|
14
|
+
#
|
15
|
+
# @see https://janus.conf.meetecho.com/docs/admin.html
|
16
|
+
class RRJAdmin < RRJ
|
17
|
+
# Create a transaction between apps and Janus for request without handle
|
18
|
+
#
|
19
|
+
# @param [Hash] options
|
20
|
+
# Give a session number for use another session in Janus
|
21
|
+
#
|
22
|
+
# @example Get Janus session
|
23
|
+
# @rrj.start_transaction_admin do |transaction|
|
24
|
+
# response = transaction.publish_message('admin:sessions').sessions
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# @since 2.0.0
|
28
|
+
def start_transaction_admin(options = {})
|
29
|
+
session = option.use_current_session?(options)
|
30
|
+
transaction = Janus::Transactions::Admin.new(session)
|
31
|
+
transaction.connect { yield(transaction) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|