actioncable 5.0.7.2 → 5.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +13 -169
- data/MIT-LICENSE +1 -1
- data/README.md +18 -15
- data/lib/action_cable.rb +9 -9
- data/lib/action_cable/channel/base.rb +17 -19
- data/lib/action_cable/channel/broadcasting.rb +2 -2
- data/lib/action_cable/channel/callbacks.rb +1 -1
- data/lib/action_cable/channel/naming.rb +2 -1
- data/lib/action_cable/channel/periodic_timers.rb +1 -1
- data/lib/action_cable/channel/streams.rb +7 -7
- data/lib/action_cable/connection.rb +0 -2
- data/lib/action_cable/connection/authorization.rb +6 -6
- data/lib/action_cable/connection/base.rb +20 -21
- data/lib/action_cable/connection/client_socket.rb +16 -16
- data/lib/action_cable/connection/identification.rb +1 -1
- data/lib/action_cable/connection/internal_channel.rb +2 -2
- data/lib/action_cable/connection/message_buffer.rb +2 -0
- data/lib/action_cable/connection/stream.rb +5 -5
- data/lib/action_cable/connection/stream_event_loop.rb +2 -2
- data/lib/action_cable/connection/subscriptions.rb +12 -10
- data/lib/action_cable/connection/tagged_logger_proxy.rb +2 -2
- data/lib/action_cable/connection/web_socket.rb +5 -3
- data/lib/action_cable/engine.rb +4 -4
- data/lib/action_cable/gem_version.rb +3 -3
- data/lib/action_cable/helpers/action_cable_helper.rb +1 -1
- data/lib/action_cable/remote_connections.rb +2 -2
- data/lib/action_cable/server.rb +1 -1
- data/lib/action_cable/server/base.rb +5 -5
- data/lib/action_cable/server/broadcasting.rb +7 -3
- data/lib/action_cable/server/configuration.rb +3 -19
- data/lib/action_cable/server/worker.rb +3 -3
- data/lib/action_cable/subscription_adapter.rb +1 -0
- data/lib/action_cable/subscription_adapter/async.rb +1 -1
- data/lib/action_cable/subscription_adapter/channel_prefix.rb +26 -0
- data/lib/action_cable/subscription_adapter/evented_redis.rb +13 -5
- data/lib/action_cable/subscription_adapter/postgresql.rb +4 -4
- data/lib/action_cable/subscription_adapter/redis.rb +9 -7
- data/lib/action_cable/subscription_adapter/subscriber_map.rb +1 -1
- data/lib/action_cable/version.rb +1 -1
- data/lib/assets/compiled/action_cable.js +554 -567
- data/lib/rails/generators/channel/USAGE +2 -2
- data/lib/rails/generators/channel/channel_generator.rb +9 -9
- data/lib/rails/generators/channel/templates/assets/cable.js +1 -1
- metadata +13 -33
- data/lib/action_cable/connection/faye_client_socket.rb +0 -48
- data/lib/action_cable/connection/faye_event_loop.rb +0 -44
@@ -3,7 +3,7 @@ Description:
|
|
3
3
|
Stubs out a new cable channel for the server (in Ruby) and client (in CoffeeScript).
|
4
4
|
Pass the channel name, either CamelCased or under_scored, and an optional list of channel actions as arguments.
|
5
5
|
|
6
|
-
Note: Turn on the cable connection in app/assets/
|
6
|
+
Note: Turn on the cable connection in app/assets/javascripts/cable.js after generating any channels.
|
7
7
|
|
8
8
|
Example:
|
9
9
|
========
|
@@ -11,4 +11,4 @@ Example:
|
|
11
11
|
|
12
12
|
creates a Chat channel class and CoffeeScript asset:
|
13
13
|
Channel: app/channels/chat_channel.rb
|
14
|
-
Assets: app/assets/
|
14
|
+
Assets: app/assets/javascripts/channels/chat.coffee
|
@@ -10,35 +10,35 @@ module Rails
|
|
10
10
|
check_class_collision suffix: "Channel"
|
11
11
|
|
12
12
|
def create_channel_file
|
13
|
-
template "channel.rb", File.join(
|
13
|
+
template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb")
|
14
14
|
|
15
15
|
if options[:assets]
|
16
|
-
if
|
16
|
+
if behavior == :invoke
|
17
17
|
template "assets/cable.js", "app/assets/javascripts/cable.js"
|
18
18
|
end
|
19
19
|
|
20
|
-
js_template "assets/channel", File.join(
|
20
|
+
js_template "assets/channel", File.join("app/assets/javascripts/channels", class_path, "#{file_name}")
|
21
21
|
end
|
22
22
|
|
23
23
|
generate_application_cable_files
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
private
|
27
27
|
def file_name
|
28
|
-
@_file_name ||= super.gsub(/_channel/i,
|
28
|
+
@_file_name ||= super.gsub(/_channel/i, "")
|
29
29
|
end
|
30
30
|
|
31
31
|
# FIXME: Change these files to symlinks once RubyGems 2.5.0 is required.
|
32
32
|
def generate_application_cable_files
|
33
|
-
return if
|
33
|
+
return if behavior != :invoke
|
34
34
|
|
35
35
|
files = [
|
36
|
-
|
37
|
-
|
36
|
+
"application_cable/channel.rb",
|
37
|
+
"application_cable/connection.rb"
|
38
38
|
]
|
39
39
|
|
40
40
|
files.each do |name|
|
41
|
-
path = File.join(
|
41
|
+
path = File.join("app/channels/", name)
|
42
42
|
template(name, path) if !File.exist?(path)
|
43
43
|
end
|
44
44
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
-
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
3
|
//
|
4
4
|
//= require action_cable
|
5
5
|
//= require_self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actioncable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.1.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pratik Naik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -17,34 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 5.0.
|
20
|
+
version: 5.1.0.beta1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 5.0.
|
27
|
+
version: 5.1.0.beta1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: nio4r
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.2'
|
35
|
-
- - "<"
|
32
|
+
- - "~>"
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
34
|
+
version: '2.0'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
38
|
requirements:
|
42
|
-
- - "
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: '1.2'
|
45
|
-
- - "<"
|
39
|
+
- - "~>"
|
46
40
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
41
|
+
version: '2.0'
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
43
|
name: websocket-driver
|
50
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,20 +53,6 @@ dependencies:
|
|
59
53
|
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: 0.6.1
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: blade
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.5.1
|
69
|
-
type: :development
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.5.1
|
76
56
|
description: Structure many real-time application concerns into channels over a single
|
77
57
|
WebSocket connection.
|
78
58
|
email:
|
@@ -97,8 +77,6 @@ files:
|
|
97
77
|
- lib/action_cable/connection/authorization.rb
|
98
78
|
- lib/action_cable/connection/base.rb
|
99
79
|
- lib/action_cable/connection/client_socket.rb
|
100
|
-
- lib/action_cable/connection/faye_client_socket.rb
|
101
|
-
- lib/action_cable/connection/faye_event_loop.rb
|
102
80
|
- lib/action_cable/connection/identification.rb
|
103
81
|
- lib/action_cable/connection/internal_channel.rb
|
104
82
|
- lib/action_cable/connection/message_buffer.rb
|
@@ -121,6 +99,7 @@ files:
|
|
121
99
|
- lib/action_cable/subscription_adapter.rb
|
122
100
|
- lib/action_cable/subscription_adapter/async.rb
|
123
101
|
- lib/action_cable/subscription_adapter/base.rb
|
102
|
+
- lib/action_cable/subscription_adapter/channel_prefix.rb
|
124
103
|
- lib/action_cable/subscription_adapter/evented_redis.rb
|
125
104
|
- lib/action_cable/subscription_adapter/inline.rb
|
126
105
|
- lib/action_cable/subscription_adapter/postgresql.rb
|
@@ -151,11 +130,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
130
|
version: 2.2.2
|
152
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
132
|
requirements:
|
154
|
-
- - "
|
133
|
+
- - ">"
|
155
134
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
135
|
+
version: 1.3.1
|
157
136
|
requirements: []
|
158
|
-
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.6.10
|
159
139
|
signing_key:
|
160
140
|
specification_version: 4
|
161
141
|
summary: WebSocket framework for Rails.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'faye/websocket'
|
2
|
-
|
3
|
-
module ActionCable
|
4
|
-
module Connection
|
5
|
-
class FayeClientSocket
|
6
|
-
def initialize(env, event_target, stream_event_loop, protocols)
|
7
|
-
@env = env
|
8
|
-
@event_target = event_target
|
9
|
-
@protocols = protocols
|
10
|
-
|
11
|
-
@faye = nil
|
12
|
-
end
|
13
|
-
|
14
|
-
def alive?
|
15
|
-
@faye && @faye.ready_state == Faye::WebSocket::API::OPEN
|
16
|
-
end
|
17
|
-
|
18
|
-
def transmit(data)
|
19
|
-
connect
|
20
|
-
@faye.send data
|
21
|
-
end
|
22
|
-
|
23
|
-
def close
|
24
|
-
@faye && @faye.close
|
25
|
-
end
|
26
|
-
|
27
|
-
def protocol
|
28
|
-
@faye && @faye.protocol
|
29
|
-
end
|
30
|
-
|
31
|
-
def rack_response
|
32
|
-
connect
|
33
|
-
@faye.rack_response
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def connect
|
38
|
-
return if @faye
|
39
|
-
@faye = Faye::WebSocket.new(@env, @protocols)
|
40
|
-
|
41
|
-
@faye.on(:open) { |event| @event_target.on_open }
|
42
|
-
@faye.on(:message) { |event| @event_target.on_message(event.data) }
|
43
|
-
@faye.on(:close) { |event| @event_target.on_close(event.reason, event.code) }
|
44
|
-
@faye.on(:error) { |event| @event_target.on_error(event.message) }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
|
3
|
-
require 'eventmachine'
|
4
|
-
EventMachine.epoll if EventMachine.epoll?
|
5
|
-
EventMachine.kqueue if EventMachine.kqueue?
|
6
|
-
|
7
|
-
module ActionCable
|
8
|
-
module Connection
|
9
|
-
class FayeEventLoop
|
10
|
-
@@mutex = Mutex.new
|
11
|
-
|
12
|
-
def timer(interval, &block)
|
13
|
-
ensure_reactor_running
|
14
|
-
EMTimer.new(::EM::PeriodicTimer.new(interval, &block))
|
15
|
-
end
|
16
|
-
|
17
|
-
def post(task = nil, &block)
|
18
|
-
task ||= block
|
19
|
-
|
20
|
-
ensure_reactor_running
|
21
|
-
::EM.next_tick(&task)
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
def ensure_reactor_running
|
26
|
-
return if EventMachine.reactor_running?
|
27
|
-
@@mutex.synchronize do
|
28
|
-
Thread.new { EventMachine.run } unless EventMachine.reactor_running?
|
29
|
-
Thread.pass until EventMachine.reactor_running?
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class EMTimer
|
34
|
-
def initialize(inner)
|
35
|
-
@inner = inner
|
36
|
-
end
|
37
|
-
|
38
|
-
def shutdown
|
39
|
-
@inner.cancel
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|