action_channels 0.1.1 → 0.1.2
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 +4 -4
- data/.gitignore +2 -0
- data/action_channels.gemspec +1 -1
- data/lib/action_channels/channel.rb +4 -0
- data/lib/action_channels/server.rb +16 -0
- data/lib/action_channels/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec1b0643e485c608718ff7be71af50540fedd155
|
4
|
+
data.tar.gz: 24ae8e570afb08fd0df6163fa816acc034ccda40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5867b4e9eea968ee6a9ae1d4a9f3b721eeabc8818652855bf753c85fa2f2dfbc2141bc4a51c090126b6c4179d3214471191c9a1a9b02bbfbe318eafd131150
|
7
|
+
data.tar.gz: 6341fe1ceee4897bb0328d6863c27332db32094a70bf64b6c56efd8850d705f0e6571bf34d3054709d436973c8e283070e01fdb4b1fcdf377af915be9324e389
|
data/.gitignore
CHANGED
data/action_channels.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
+
f.match(%r{^(test|spec|features|examples)/})
|
19
19
|
end
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -23,12 +23,16 @@ module ActionChannels
|
|
23
23
|
|
24
24
|
def add_client(client)
|
25
25
|
clients << client
|
26
|
+
|
26
27
|
ActionChannels.logger.info "The channel ##{self.name} added a client"
|
28
|
+
ActionChannels.logger.debug "Count of client of channel ##{self.name} is #{self.clients.count}."
|
27
29
|
end
|
28
30
|
|
29
31
|
def remove_client(client)
|
30
32
|
clients.delete client
|
33
|
+
|
31
34
|
ActionChannels.logger.info "The channel ##{self.name} removed a client"
|
35
|
+
ActionChannels.logger.debug "Count of client of channel ##{self.name} is #{self.clients.count}."
|
32
36
|
end
|
33
37
|
|
34
38
|
def notify_all(message)
|
@@ -23,6 +23,8 @@ module ActionChannels
|
|
23
23
|
def process_client(client)
|
24
24
|
client.on :message, callback_on_message(client)
|
25
25
|
client.on :close, callback_on_close(client)
|
26
|
+
client.on :error, callback_on_error(client)
|
27
|
+
client.on :io_error, callback_on_io_error(client)
|
26
28
|
|
27
29
|
client
|
28
30
|
end
|
@@ -47,6 +49,20 @@ module ActionChannels
|
|
47
49
|
@message_sender ||= MessageSenders::WebSocket.new
|
48
50
|
end
|
49
51
|
|
52
|
+
def callback_on_io_error(client)
|
53
|
+
proc do
|
54
|
+
ActionChannels.logger.error "Received io_error."
|
55
|
+
channel_repository.all.each { |channel| channel.remove_client(client) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def callback_on_error(client)
|
60
|
+
lambda do |event|
|
61
|
+
ActionChannels.logger.error "Received error: #{event.message}"
|
62
|
+
channel_repository.all.each { |channel| channel.remove_client(client) }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
50
66
|
def callback_on_close(client)
|
51
67
|
lambda do |event|
|
52
68
|
ActionChannels.logger.info "Client closed connection."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_channels
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- German Antsiferov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nio4r-websocket
|