websocket_messaging 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lib/websocket_messaging.rb +5 -0
- data/lib/websocket_messaging/channel.rb +65 -0
- data/lib/websocket_messaging/multicast_notifier.rb +15 -0
- data/lib/websocket_messaging/notifier.rb +50 -0
- data/lib/websocket_messaging/version.rb +3 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/websocket_messaging/channel_spec.rb +154 -0
- data/spec/websocket_messaging/multicast_notifier_spec.rb +36 -0
- data/spec/websocket_messaging/notifier_spec.rb +75 -0
- data/websocket_messaging.gemspec +33 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad771f4dba1ca131d518f83d558582fe4289c14c
|
4
|
+
data.tar.gz: 1daf14710bffcd1e16079e537936683aac699468
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d979edf012c16f13d11d449c1fede4792c2d7399a8b5e9ec3df85902028740a609f97b76b88666ab160a42e8acd8f8575ec0d0a37fecb76ff425322f9bb4f0fd
|
7
|
+
data.tar.gz: e615d6dca1838c64b1be003da02d347c474022d151346b7aff05ee84147ad21d8f3ef0ee046f37bfda702db95de6238195bce7ceb6843f4f4220910636fa0dcd
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Artur Hebda
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# WebsocketMessaging
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'websocket_messaging'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install websocket_messaging
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/websocket_messaging/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'websocket_messaging/notifier'
|
2
|
+
|
3
|
+
module WebsocketMessaging
|
4
|
+
class Channel
|
5
|
+
attr_reader :notifier, :socket
|
6
|
+
|
7
|
+
def initialize(id)
|
8
|
+
@notifier = Notifier.new(id)
|
9
|
+
@handlers = {
|
10
|
+
before_send: ->(data) { data },
|
11
|
+
onmessage: ->(data) {}
|
12
|
+
}
|
13
|
+
|
14
|
+
yield self if block_given?
|
15
|
+
end
|
16
|
+
|
17
|
+
def start(socket)
|
18
|
+
@socket = socket
|
19
|
+
|
20
|
+
subscribe_notifier
|
21
|
+
subscribe_socket_messages
|
22
|
+
subscribe_socket_closed
|
23
|
+
end
|
24
|
+
|
25
|
+
def subscribe_notifier
|
26
|
+
notifier.subscribe do |data|
|
27
|
+
send_socket_message(data)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def subscribe_socket_messages
|
32
|
+
socket.onmessage do |message|
|
33
|
+
data = JSON.parse(message)
|
34
|
+
receive_message(data)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def subscribe_socket_closed
|
39
|
+
socket.onclose do
|
40
|
+
notifier.unsubscribe
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def onmessage(&handler)
|
45
|
+
@handlers[:onmessage] = handler
|
46
|
+
end
|
47
|
+
|
48
|
+
def before_send(&handler)
|
49
|
+
@handlers[:before_send] = handler
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def send_socket_message(data)
|
55
|
+
to_send = @handlers[:before_send].call(data)
|
56
|
+
if to_send && to_send.respond_to?(:to_json)
|
57
|
+
socket.send_data(to_send.to_json)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def receive_message(data)
|
62
|
+
@handlers[:onmessage].call(data)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module WebsocketMessaging
|
2
|
+
class MulticastNotifier
|
3
|
+
attr_reader :notifiers
|
4
|
+
|
5
|
+
def initialize(channel_ids, notifier_builder)
|
6
|
+
@notifiers = Array(channel_ids).map do |channel_id|
|
7
|
+
notifier_builder.call(channel_id)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def notify(message)
|
12
|
+
@notifiers.each { |n| n.notify(message) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'websocket_messaging/multicast_notifier'
|
3
|
+
|
4
|
+
module WebsocketMessaging
|
5
|
+
class BusConnectorNotDefinedError < StandardError; end
|
6
|
+
|
7
|
+
class Notifier < Struct.new(:channel_id)
|
8
|
+
def subscribe(&block)
|
9
|
+
@subscription = Thread.new do
|
10
|
+
connect_to_bus.subscribe(channel_id) do |bus|
|
11
|
+
bus.message do |channel, message|
|
12
|
+
data = JSON.parse(message)
|
13
|
+
block.call(data)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def multicast(channel_ids)
|
20
|
+
MulticastNotifier.new(channel_ids, self.class.public_method(:new))
|
21
|
+
end
|
22
|
+
|
23
|
+
def notify(message)
|
24
|
+
return unless message && message.respond_to?(:to_json)
|
25
|
+
connect_to_bus.publish(channel_id, message.to_json)
|
26
|
+
end
|
27
|
+
|
28
|
+
def unsubscribe
|
29
|
+
@subscription.kill
|
30
|
+
end
|
31
|
+
|
32
|
+
def connect_to_bus
|
33
|
+
self.class.bus_connector.call
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.bus_connector=(connector)
|
37
|
+
@bus_connector = connector
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.bus_connector
|
41
|
+
unless @bus_connector
|
42
|
+
raise BusConnectorNotDefinedError,
|
43
|
+
%[you have to define a bus connector,
|
44
|
+
i.e. returning a new connection to redis]
|
45
|
+
end
|
46
|
+
|
47
|
+
@bus_connector
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "websocket_messaging/channel"
|
3
|
+
require "websocket_messaging/notifier"
|
4
|
+
|
5
|
+
describe WebsocketMessaging::Channel do
|
6
|
+
describe "#new" do
|
7
|
+
let(:id) { 1 }
|
8
|
+
|
9
|
+
it "creates a dedicated notifier" do
|
10
|
+
expect(WebsocketMessaging::Notifier).to receive(:new)
|
11
|
+
.with(id).and_call_original
|
12
|
+
|
13
|
+
channel = described_class.new(id)
|
14
|
+
expect(channel.notifier).to_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "passes self to a block if given" do
|
18
|
+
config = double(call: nil)
|
19
|
+
channel = described_class.new(id) do |channel|
|
20
|
+
config.call(channel)
|
21
|
+
end
|
22
|
+
|
23
|
+
expect(config).to have_received(:call).with(channel)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#start" do
|
28
|
+
let(:id) { 1 }
|
29
|
+
let(:socket) { double }
|
30
|
+
|
31
|
+
subject { described_class.new(id) }
|
32
|
+
|
33
|
+
it "subscribes to notifier and socket" do
|
34
|
+
expect(subject).to receive(:subscribe_notifier)
|
35
|
+
expect(subject).to receive(:subscribe_socket_messages)
|
36
|
+
expect(subject).to receive(:subscribe_socket_closed)
|
37
|
+
|
38
|
+
subject.start(socket)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "internal notify" do
|
43
|
+
let(:id) { 1 }
|
44
|
+
let(:parsed_data) { { "a" => 3 } }
|
45
|
+
let(:raw_data) { parsed_data.to_json }
|
46
|
+
let(:changed_data){ parsed_data.merge("b" => 4) }
|
47
|
+
let(:socket) { double("socket", send_data: nil) }
|
48
|
+
let(:notifier) { double("notifier") }
|
49
|
+
|
50
|
+
subject { described_class.new(id) }
|
51
|
+
|
52
|
+
before(:each) do
|
53
|
+
expect(WebsocketMessaging::Notifier).to receive(:new).and_return(notifier)
|
54
|
+
|
55
|
+
expect(notifier).to receive(:subscribe) do |&handler|
|
56
|
+
@internal_notify = handler
|
57
|
+
end
|
58
|
+
|
59
|
+
allow(subject).to receive(:subscribe_socket_closed)
|
60
|
+
allow(subject).to receive(:subscribe_socket_messages)
|
61
|
+
|
62
|
+
subject.start(socket)
|
63
|
+
end
|
64
|
+
|
65
|
+
context "default handler" do
|
66
|
+
it "passes the received data" do
|
67
|
+
@internal_notify.call(parsed_data)
|
68
|
+
expect(socket).to have_received(:send_data).with(raw_data)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "handler returning object that responds to :to_json" do
|
73
|
+
before(:each) do
|
74
|
+
subject.before_send do |data|
|
75
|
+
changed_data
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "sends returned object cast to json" do
|
80
|
+
@internal_notify.call(parsed_data)
|
81
|
+
expect(socket).to have_received(:send_data).with(changed_data.to_json)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "handler returning false" do
|
86
|
+
before(:each) do
|
87
|
+
subject.before_send { |_| false }
|
88
|
+
end
|
89
|
+
|
90
|
+
it "does not send anything" do
|
91
|
+
@internal_notify.call(parsed_data)
|
92
|
+
expect(socket).to_not have_received(:send_data)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "message from socket" do
|
98
|
+
let(:id) { 1 }
|
99
|
+
let(:parsed_data) { { "a" => 3 } }
|
100
|
+
let(:raw_data) { parsed_data.to_json }
|
101
|
+
let(:socket) { double("socket") }
|
102
|
+
let(:message_received) { double(call: nil) }
|
103
|
+
|
104
|
+
subject { described_class.new(id) }
|
105
|
+
|
106
|
+
before(:each) do
|
107
|
+
expect(socket).to receive(:onmessage) do |&handler|
|
108
|
+
@incoming_socket_message = handler
|
109
|
+
end
|
110
|
+
|
111
|
+
allow(subject).to receive(:subscribe_notifier)
|
112
|
+
allow(subject).to receive(:subscribe_socket_closed)
|
113
|
+
|
114
|
+
subject.start(socket)
|
115
|
+
end
|
116
|
+
|
117
|
+
context "defined handler" do
|
118
|
+
it "gets called with parsed data" do
|
119
|
+
subject.onmessage do |data|
|
120
|
+
message_received.call(data) # simply pass through
|
121
|
+
end
|
122
|
+
|
123
|
+
@incoming_socket_message.call(raw_data)
|
124
|
+
expect(message_received).to have_received(:call).with(parsed_data)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "socket closed" do
|
130
|
+
let(:id) { 1 }
|
131
|
+
let(:socket) { double("socket") }
|
132
|
+
let(:notifier) { double("notifier", unsubscribe: nil) }
|
133
|
+
|
134
|
+
subject { described_class.new(id) }
|
135
|
+
|
136
|
+
before(:each) do
|
137
|
+
expect(WebsocketMessaging::Notifier).to receive(:new).and_return(notifier)
|
138
|
+
|
139
|
+
expect(socket).to receive(:onclose) do |&handler|
|
140
|
+
@socket_closed = handler
|
141
|
+
end
|
142
|
+
|
143
|
+
allow(subject).to receive(:subscribe_socket_messages)
|
144
|
+
allow(subject).to receive(:subscribe_notifier)
|
145
|
+
|
146
|
+
subject.start(socket)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "unsubscribes from notifier" do
|
150
|
+
@socket_closed.call
|
151
|
+
expect(notifier).to have_received(:unsubscribe)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "websocket_messaging/multicast_notifier"
|
3
|
+
|
4
|
+
describe WebsocketMessaging::MulticastNotifier do
|
5
|
+
describe "#new" do
|
6
|
+
let(:channels) { [1, 2] }
|
7
|
+
let(:notifier) { double("channel notifier") }
|
8
|
+
let(:notifier_builder) do
|
9
|
+
double(call: notifier)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "creates a notifier for each channel" do
|
13
|
+
multicast = described_class.new(channels, notifier_builder)
|
14
|
+
expect(notifier_builder).to have_received(:call).with(1)
|
15
|
+
expect(notifier_builder).to have_received(:call).with(2)
|
16
|
+
expect(multicast.notifiers).to match_array [notifier, notifier]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#notify" do
|
21
|
+
let(:message) { "message" }
|
22
|
+
let(:channels) { [1, 2] }
|
23
|
+
let(:notifier_builder) do
|
24
|
+
->(channel_id) { double(notify: nil) }
|
25
|
+
end
|
26
|
+
|
27
|
+
subject { described_class.new(channels, notifier_builder) }
|
28
|
+
|
29
|
+
it "notifies all channels" do
|
30
|
+
subject.notify(message)
|
31
|
+
subject.notifiers.each do |notifier|
|
32
|
+
expect(notifier).to have_received(:notify).with(message)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require 'redis'
|
4
|
+
require 'websocket_messaging/notifier'
|
5
|
+
require 'websocket_messaging/multicast_notifier'
|
6
|
+
|
7
|
+
describe WebsocketMessaging::Notifier do
|
8
|
+
describe "#multicast" do
|
9
|
+
let(:channel_id) { 1 }
|
10
|
+
let(:channel_ids) { [2, 3] }
|
11
|
+
let(:notifier_builder) { described_class.public_method(:new) }
|
12
|
+
|
13
|
+
subject { described_class.new(channel_id) }
|
14
|
+
|
15
|
+
it "creates multicast notifier for passed channels" do
|
16
|
+
expect(WebsocketMessaging::MulticastNotifier).to receive(:new)
|
17
|
+
.with(channel_ids, notifier_builder)
|
18
|
+
|
19
|
+
subject.multicast(channel_ids)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#notify" do
|
24
|
+
let(:bus_connection) { double("bus", publish: nil) }
|
25
|
+
let(:bus_connector) { double(call: bus_connection) }
|
26
|
+
let(:parsed_data) { { "a" => 3 } }
|
27
|
+
let(:raw_data) { parsed_data.to_json }
|
28
|
+
let(:channel_id) { 1 }
|
29
|
+
|
30
|
+
subject { described_class.new(channel_id) }
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
described_class.bus_connector = bus_connector
|
34
|
+
end
|
35
|
+
|
36
|
+
context "message responding to :to_json" do
|
37
|
+
it "publishes to bus on the related channel" do
|
38
|
+
subject.notify(parsed_data)
|
39
|
+
|
40
|
+
expect(bus_connection).to have_received(:publish)
|
41
|
+
.with(channel_id, raw_data)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "other messages" do
|
46
|
+
it "does not publish anything" do
|
47
|
+
subject.notify(nil)
|
48
|
+
expect(bus_connection).to_not have_received(:publish)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "messaging flow through bus" do
|
54
|
+
before(:all) do
|
55
|
+
described_class.bus_connector = -> { Redis.new }
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:channel_id) { 1 }
|
59
|
+
let(:parsed_data) { { "a" => 3 } }
|
60
|
+
let(:receiver) { double("receiver", call: nil) }
|
61
|
+
|
62
|
+
subject { described_class.new(channel_id) }
|
63
|
+
|
64
|
+
it "allows to receive messages sent on the channel" do
|
65
|
+
subject.subscribe do |data|
|
66
|
+
receiver.call(data)
|
67
|
+
end
|
68
|
+
|
69
|
+
subject.notify(parsed_data)
|
70
|
+
subject.unsubscribe
|
71
|
+
|
72
|
+
expect(receiver).to have_received(:call).with(parsed_data)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'websocket_messaging/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "websocket_messaging"
|
8
|
+
spec.version = WebsocketMessaging::VERSION
|
9
|
+
spec.authors = ["Artur Hebda"]
|
10
|
+
spec.email = ["arturhebda@gmail.com"]
|
11
|
+
spec.summary = %[Messaging platform for sending json data that supports many-to-many
|
12
|
+
connections using sockets, i.e. websockets.]
|
13
|
+
spec.description = %[This gem has been extracted from chat application based on websockets.
|
14
|
+
It consists of basically two components: channels and notifiers. Channels are meant to handle
|
15
|
+
external communication through provided socket in a bidirectional manner while
|
16
|
+
using notifiers for internal communication. Notifiers are using a messaging bus,
|
17
|
+
which might be anything supporting publish/subscribe pattern across multiple threads / processes,
|
18
|
+
i.e. common Redis cluster. It lets you define your own handlers for receiving and sending data.]
|
19
|
+
spec.homepage = "https://github.com/growthrepublic/websocket_messaging"
|
20
|
+
spec.license = "MIT"
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_development_dependency "redis", "~> 3.0"
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.3"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0.0.rc1"
|
31
|
+
spec.add_development_dependency "rspec-its", "~> 1.0"
|
32
|
+
spec.add_development_dependency "rspec-mocks", "~> 3.0.0.rc1"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: websocket_messaging
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Artur Hebda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redis
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0.rc1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0.rc1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-mocks
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0.rc1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0.rc1
|
97
|
+
description: |-
|
98
|
+
This gem has been extracted from chat application based on websockets.
|
99
|
+
It consists of basically two components: channels and notifiers. Channels are meant to handle
|
100
|
+
external communication through provided socket in a bidirectional manner while
|
101
|
+
using notifiers for internal communication. Notifiers are using a messaging bus,
|
102
|
+
which might be anything supporting publish/subscribe pattern across multiple threads / processes,
|
103
|
+
i.e. common Redis cluster. It lets you define your own handlers for receiving and sending data.
|
104
|
+
email:
|
105
|
+
- arturhebda@gmail.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- ".gitignore"
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- lib/websocket_messaging.rb
|
116
|
+
- lib/websocket_messaging/channel.rb
|
117
|
+
- lib/websocket_messaging/multicast_notifier.rb
|
118
|
+
- lib/websocket_messaging/notifier.rb
|
119
|
+
- lib/websocket_messaging/version.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- spec/websocket_messaging/channel_spec.rb
|
122
|
+
- spec/websocket_messaging/multicast_notifier_spec.rb
|
123
|
+
- spec/websocket_messaging/notifier_spec.rb
|
124
|
+
- websocket_messaging.gemspec
|
125
|
+
homepage: https://github.com/growthrepublic/websocket_messaging
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.2.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Messaging platform for sending json data that supports many-to-many connections
|
149
|
+
using sockets, i.e. websockets.
|
150
|
+
test_files:
|
151
|
+
- spec/spec_helper.rb
|
152
|
+
- spec/websocket_messaging/channel_spec.rb
|
153
|
+
- spec/websocket_messaging/multicast_notifier_spec.rb
|
154
|
+
- spec/websocket_messaging/notifier_spec.rb
|
155
|
+
has_rdoc:
|