hornet-connector-ruby 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +1 -1
- data/.gitignore +3 -0
- data/README.md +31 -0
- data/Rakefile +0 -3
- data/VERSION +1 -1
- data/hornet-connector-ruby.gemspec +8 -9
- data/lib/hornet.rb +6 -6
- metadata +6 -6
- data/README.rdoc +0 -5
data/.document
CHANGED
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Hornet Ruby Connector
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
[Hornet](https://github.com/nectify/hornet) is a realtime engine that let you enhance your web application by connecting users together. [Hornet](https://github.com/nectify/hornet) is a publish/suscribe system extremely easy to use, secure and scalable. Well, [Hornet](https://github.com/nectify/hornet) will integrates very well your own existing application, no matter what language or framework you're using.
|
6
|
+
|
7
|
+
[Hornet](https://github.com/nectify/hornet) is powered by NodeJs, Socket.io and is backed by Redis.
|
8
|
+
|
9
|
+
The current library is a connector, a piece of software that will make your application able to talk with [Hornet](https://github.com/nectify/hornet). See Hornet README for the connector specification
|
10
|
+
|
11
|
+
|
12
|
+
### Hornet philosophy: core engine and connectors
|
13
|
+
|
14
|
+
Hornet is intented to act as a hub for your existing web application, offering the possibility to keep a pool of connected users and broadcasting messages to them in realtime. That's where NodeJS is goot at.
|
15
|
+
|
16
|
+
The connector is a small library that your existing application will use to connect your clients to Hornet and to broadcast message to them. When a client access a page with realtime features on it, your web application will generates a connection token to let the client subscribe to a hornet channel.
|
17
|
+
|
18
|
+
When you want to broadcast a message to a specific channel, you'll also use the hornet connector to publish it. Using Redis publish/subscribe mechanism, Hornet core engines will be notified by this new message and transfer it to subscribed clients.
|
19
|
+
|
20
|
+
Hornet messages should always be JSON valid objects, containing at least the "type" attribute.
|
21
|
+
|
22
|
+
## Connector Installation
|
23
|
+
|
24
|
+
Add the following dependency in your Gemfile:
|
25
|
+
|
26
|
+
gem "hornet-connector-ruby"
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
This project is distributed under Apache 2 License. See LICENSE.txt for more information.
|
31
|
+
|
data/Rakefile
CHANGED
@@ -13,9 +13,6 @@ begin
|
|
13
13
|
gem.rubyforge_project = "hornet-connector-ruby"
|
14
14
|
gem.add_dependency 'alphadecimal'
|
15
15
|
end
|
16
|
-
Jeweler::RubyforgeTasks.new do |rubyforge|
|
17
|
-
rubyforge.doc_task = "rdoc"
|
18
|
-
end
|
19
16
|
rescue LoadError
|
20
17
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
18
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -5,23 +5,23 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hornet-connector-ruby}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-06-
|
11
|
+
s.authors = [%q{Robin Komiwes}, %q{Benjamin Tierny}, %q{Tristan Bourgois}, %q{Maxime Brazeilles}]
|
12
|
+
s.date = %q{2011-06-24}
|
13
13
|
s.description = %q{Hornet Ruby Connector is a connector for Hornet, a realtime engine backed by Redis and Socket.io}
|
14
14
|
s.email = %q{robin.komiwes@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"Gemfile",
|
23
23
|
"LICENSE",
|
24
|
-
"README.
|
24
|
+
"README.md",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"hornet-connector-ruby.gemspec",
|
@@ -31,10 +31,10 @@ Gem::Specification.new do |s|
|
|
31
31
|
"test/test_helper.rb"
|
32
32
|
]
|
33
33
|
s.homepage = %q{http://github.com/nectify/hornet-connector-ruby}
|
34
|
-
s.rdoc_options = [
|
35
|
-
s.require_paths = [
|
34
|
+
s.rdoc_options = [%q{--charset=UTF-8}]
|
35
|
+
s.require_paths = [%q{lib}]
|
36
36
|
s.rubyforge_project = %q{hornet-connector-ruby}
|
37
|
-
s.rubygems_version = %q{1.
|
37
|
+
s.rubygems_version = %q{1.8.5}
|
38
38
|
s.summary = %q{Hornet Ruby Connector - Realtime engine for webapps}
|
39
39
|
s.test_files = [
|
40
40
|
"test/hornet-connector-ruby_test.rb",
|
@@ -42,7 +42,6 @@ Gem::Specification.new do |s|
|
|
42
42
|
]
|
43
43
|
|
44
44
|
if s.respond_to? :specification_version then
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
45
|
s.specification_version = 3
|
47
46
|
|
48
47
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/hornet.rb
CHANGED
@@ -8,10 +8,10 @@ module Hornet
|
|
8
8
|
"hornet:events:disconnect"
|
9
9
|
]
|
10
10
|
|
11
|
-
def
|
12
|
-
@
|
11
|
+
def token_TTL( token_TTL )
|
12
|
+
@token_TTL ||= token_TTL
|
13
13
|
|
14
|
-
@
|
14
|
+
@token_TTL || 120
|
15
15
|
end
|
16
16
|
|
17
17
|
def redis_options(redis_option={})
|
@@ -30,14 +30,14 @@ module Hornet
|
|
30
30
|
def create_access_token(channel)
|
31
31
|
token_id = redis.incr "hornet:tokens_id"
|
32
32
|
|
33
|
-
token = (token_id.to_s + generate_token_suffix).alphadecimal
|
33
|
+
token = (token_id.to_s + generate_token_suffix).to_i.alphadecimal
|
34
34
|
|
35
35
|
redis.set "hornet:token:" + token, channel
|
36
36
|
|
37
37
|
return token;
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def disconnect_tokens(tokens)
|
41
41
|
disconnectMsg = "token:" + tokens.to_json
|
42
42
|
|
43
43
|
publish("hornet", "disconnect_tokens", disconnectMsg)
|
@@ -45,7 +45,7 @@ module Hornet
|
|
45
45
|
|
46
46
|
|
47
47
|
def publish(channel, type, message, options)
|
48
|
-
redis.publish("hornet:channel:" + channel.to_s, message.merge(type).merge(options).to_json)
|
48
|
+
redis.publish("hornet:channel:" + channel.to_s, message.merge(:type => type).merge(options).to_json)
|
49
49
|
end
|
50
50
|
|
51
51
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hornet-connector-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robin Komiwes
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-06-
|
21
|
+
date: 2011-06-24 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: alphadecimal
|
@@ -42,13 +42,13 @@ extensions: []
|
|
42
42
|
|
43
43
|
extra_rdoc_files:
|
44
44
|
- LICENSE
|
45
|
-
- README.
|
45
|
+
- README.md
|
46
46
|
files:
|
47
47
|
- .document
|
48
48
|
- .gitignore
|
49
49
|
- Gemfile
|
50
50
|
- LICENSE
|
51
|
-
- README.
|
51
|
+
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- VERSION
|
54
54
|
- hornet-connector-ruby.gemspec
|