actioncable 7.0.8.1 → 7.2.2.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 +4 -4
- data/CHANGELOG.md +34 -150
- data/MIT-LICENSE +1 -1
- data/README.md +4 -4
- data/app/assets/javascripts/action_cable.js +30 -9
- data/app/assets/javascripts/actioncable.esm.js +30 -9
- data/app/assets/javascripts/actioncable.js +30 -9
- data/lib/action_cable/channel/base.rb +114 -90
- data/lib/action_cable/channel/broadcasting.rb +25 -16
- data/lib/action_cable/channel/callbacks.rb +39 -0
- data/lib/action_cable/channel/naming.rb +10 -7
- data/lib/action_cable/channel/periodic_timers.rb +7 -7
- data/lib/action_cable/channel/streams.rb +77 -62
- data/lib/action_cable/channel/test_case.rb +117 -86
- data/lib/action_cable/connection/authorization.rb +4 -1
- data/lib/action_cable/connection/base.rb +70 -42
- data/lib/action_cable/connection/callbacks.rb +57 -0
- data/lib/action_cable/connection/client_socket.rb +3 -1
- data/lib/action_cable/connection/identification.rb +9 -5
- data/lib/action_cable/connection/internal_channel.rb +7 -2
- data/lib/action_cable/connection/message_buffer.rb +4 -1
- data/lib/action_cable/connection/stream.rb +2 -2
- data/lib/action_cable/connection/stream_event_loop.rb +4 -4
- data/lib/action_cable/connection/subscriptions.rb +7 -2
- data/lib/action_cable/connection/tagged_logger_proxy.rb +12 -7
- data/lib/action_cable/connection/test_case.rb +67 -55
- data/lib/action_cable/connection/web_socket.rb +11 -7
- data/lib/action_cable/deprecator.rb +9 -0
- data/lib/action_cable/engine.rb +18 -8
- data/lib/action_cable/gem_version.rb +5 -3
- data/lib/action_cable/helpers/action_cable_helper.rb +21 -19
- data/lib/action_cable/remote_connections.rb +25 -13
- data/lib/action_cable/server/base.rb +29 -14
- data/lib/action_cable/server/broadcasting.rb +24 -16
- data/lib/action_cable/server/configuration.rb +27 -14
- data/lib/action_cable/server/connections.rb +13 -5
- data/lib/action_cable/server/worker/active_record_connection_management.rb +2 -0
- data/lib/action_cable/server/worker.rb +4 -3
- data/lib/action_cable/subscription_adapter/async.rb +1 -1
- data/lib/action_cable/subscription_adapter/base.rb +2 -0
- data/lib/action_cable/subscription_adapter/channel_prefix.rb +2 -0
- data/lib/action_cable/subscription_adapter/inline.rb +2 -0
- data/lib/action_cable/subscription_adapter/postgresql.rb +4 -3
- data/lib/action_cable/subscription_adapter/redis.rb +7 -7
- data/lib/action_cable/subscription_adapter/subscriber_map.rb +2 -0
- data/lib/action_cable/subscription_adapter/test.rb +6 -5
- data/lib/action_cable/test_case.rb +2 -0
- data/lib/action_cable/test_helper.rb +89 -59
- data/lib/action_cable/version.rb +3 -1
- data/lib/action_cable.rb +30 -12
- data/lib/rails/generators/channel/USAGE +14 -8
- data/lib/rails/generators/channel/channel_generator.rb +23 -7
- data/lib/rails/generators/test_unit/channel_generator.rb +2 -0
- metadata +32 -20
- data/lib/action_cable/channel.rb +0 -17
- data/lib/action_cable/connection.rb +0 -22
- data/lib/action_cable/server.rb +0 -16
- data/lib/action_cable/subscription_adapter.rb +0 -12
- /data/lib/rails/generators/channel/templates/application_cable/{channel.rb → channel.rb.tt} +0 -0
- /data/lib/rails/generators/channel/templates/application_cable/{connection.rb → connection.rb.tt} +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# :markup: markdown
|
4
4
|
|
5
|
-
gem "redis", ">=
|
5
|
+
gem "redis", ">= 4", "< 6"
|
6
6
|
require "redis"
|
7
7
|
|
8
8
|
require "active_support/core_ext/hash/except"
|
@@ -12,8 +12,9 @@ module ActionCable
|
|
12
12
|
class Redis < Base # :nodoc:
|
13
13
|
prepend ChannelPrefix
|
14
14
|
|
15
|
-
# Overwrite this factory method for Redis connections if you want to use a
|
16
|
-
# This is needed, for example, when
|
15
|
+
# Overwrite this factory method for Redis connections if you want to use a
|
16
|
+
# different Redis library than the redis gem. This is needed, for example, when
|
17
|
+
# using Makara proxies for distributed Redis.
|
17
18
|
cattr_accessor :redis_connector, default: ->(config) do
|
18
19
|
::Redis.new(config.except(:adapter, :channel_prefix))
|
19
20
|
end
|
@@ -209,7 +210,7 @@ module ActionCable
|
|
209
210
|
end
|
210
211
|
|
211
212
|
if ::Redis::VERSION < "5"
|
212
|
-
ConnectionError = ::Redis::
|
213
|
+
ConnectionError = ::Redis::BaseConnectionError
|
213
214
|
|
214
215
|
class SubscribedClient
|
215
216
|
def initialize(raw_client)
|
@@ -240,8 +241,7 @@ module ActionCable
|
|
240
241
|
end
|
241
242
|
|
242
243
|
def extract_subscribed_client(conn)
|
243
|
-
|
244
|
-
SubscribedClient.new(raw_client)
|
244
|
+
SubscribedClient.new(conn._client)
|
245
245
|
end
|
246
246
|
else
|
247
247
|
ConnectionError = RedisClient::ConnectionError
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# :markup: markdown
|
4
4
|
|
5
5
|
module ActionCable
|
6
6
|
module SubscriptionAdapter
|
7
|
-
#
|
7
|
+
# ## Test adapter for Action Cable
|
8
8
|
#
|
9
9
|
# The test adapter should be used only in testing. Along with
|
10
10
|
# ActionCable::TestHelper it makes a great tool to test your Rails application.
|
11
11
|
#
|
12
|
-
# To use the test adapter set
|
12
|
+
# To use the test adapter set `adapter` value to `test` in your
|
13
|
+
# `config/cable.yml` file.
|
13
14
|
#
|
14
|
-
# NOTE: Test adapter extends the
|
15
|
-
# so it could be used in system tests too.
|
15
|
+
# NOTE: `Test` adapter extends the `ActionCable::SubscriptionAdapter::Async`
|
16
|
+
# adapter, so it could be used in system tests too.
|
16
17
|
class Test < Async
|
17
18
|
def broadcast(channel, payload)
|
18
19
|
broadcasts(channel) << payload
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# :markup: markdown
|
4
|
+
|
3
5
|
module ActionCable
|
4
6
|
# Provides helper methods for testing Action Cable broadcasting
|
5
7
|
module TestHelper
|
@@ -18,105 +20,123 @@ module ActionCable
|
|
18
20
|
ActionCable.server.instance_variable_set(:@pubsub, @old_pubsub_adapter)
|
19
21
|
end
|
20
22
|
|
21
|
-
# Asserts that the number of broadcasted messages to the stream matches the
|
22
|
-
#
|
23
|
-
# def test_broadcasts
|
24
|
-
# assert_broadcasts 'messages', 0
|
25
|
-
# ActionCable.server.broadcast 'messages', { text: 'hello' }
|
26
|
-
# assert_broadcasts 'messages', 1
|
27
|
-
# ActionCable.server.broadcast 'messages', { text: 'world' }
|
28
|
-
# assert_broadcasts 'messages', 2
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# If a block is passed, that block should cause the specified number of
|
32
|
-
# messages to be broadcasted.
|
23
|
+
# Asserts that the number of broadcasted messages to the stream matches the
|
24
|
+
# given number.
|
33
25
|
#
|
34
|
-
#
|
35
|
-
#
|
26
|
+
# def test_broadcasts
|
27
|
+
# assert_broadcasts 'messages', 0
|
36
28
|
# ActionCable.server.broadcast 'messages', { text: 'hello' }
|
29
|
+
# assert_broadcasts 'messages', 1
|
30
|
+
# ActionCable.server.broadcast 'messages', { text: 'world' }
|
31
|
+
# assert_broadcasts 'messages', 2
|
37
32
|
# end
|
38
33
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
34
|
+
# If a block is passed, that block should cause the specified number of messages
|
35
|
+
# to be broadcasted.
|
36
|
+
#
|
37
|
+
# def test_broadcasts_again
|
38
|
+
# assert_broadcasts('messages', 1) do
|
39
|
+
# ActionCable.server.broadcast 'messages', { text: 'hello' }
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# assert_broadcasts('messages', 2) do
|
43
|
+
# ActionCable.server.broadcast 'messages', { text: 'hi' }
|
44
|
+
# ActionCable.server.broadcast 'messages', { text: 'how are you?' }
|
45
|
+
# end
|
42
46
|
# end
|
43
|
-
# end
|
44
47
|
#
|
45
48
|
def assert_broadcasts(stream, number, &block)
|
46
49
|
if block_given?
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
actual_count
|
50
|
+
new_messages = new_broadcasts_from(broadcasts(stream), stream, "assert_broadcasts", &block)
|
51
|
+
|
52
|
+
actual_count = new_messages.size
|
53
|
+
assert_equal number, actual_count, "#{number} broadcasts to #{stream} expected, but #{actual_count} were sent"
|
51
54
|
else
|
52
|
-
actual_count =
|
55
|
+
actual_count = broadcasts(stream).size
|
56
|
+
assert_equal number, actual_count, "#{number} broadcasts to #{stream} expected, but #{actual_count} were sent"
|
53
57
|
end
|
54
|
-
|
55
|
-
assert_equal number, actual_count, "#{number} broadcasts to #{stream} expected, but #{actual_count} were sent"
|
56
58
|
end
|
57
59
|
|
58
60
|
# Asserts that no messages have been sent to the stream.
|
59
61
|
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
62
|
+
# def test_no_broadcasts
|
63
|
+
# assert_no_broadcasts 'messages'
|
64
|
+
# ActionCable.server.broadcast 'messages', { text: 'hi' }
|
65
|
+
# assert_broadcasts 'messages', 1
|
66
|
+
# end
|
65
67
|
#
|
66
68
|
# If a block is passed, that block should not cause any message to be sent.
|
67
69
|
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
70
|
+
# def test_broadcasts_again
|
71
|
+
# assert_no_broadcasts 'messages' do
|
72
|
+
# # No job messages should be sent from this block
|
73
|
+
# end
|
71
74
|
# end
|
72
|
-
# end
|
73
75
|
#
|
74
76
|
# Note: This assertion is simply a shortcut for:
|
75
77
|
#
|
76
|
-
#
|
78
|
+
# assert_broadcasts 'messages', 0, &block
|
77
79
|
#
|
78
80
|
def assert_no_broadcasts(stream, &block)
|
79
81
|
assert_broadcasts stream, 0, &block
|
80
82
|
end
|
81
83
|
|
82
|
-
#
|
84
|
+
# Returns the messages that are broadcasted in the block.
|
83
85
|
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
86
|
+
# def test_broadcasts
|
87
|
+
# messages = capture_broadcasts('messages') do
|
88
|
+
# ActionCable.server.broadcast 'messages', { text: 'hi' }
|
89
|
+
# ActionCable.server.broadcast 'messages', { text: 'how are you?' }
|
90
|
+
# end
|
91
|
+
# assert_equal 2, messages.length
|
92
|
+
# assert_equal({ text: 'hi' }, messages.first)
|
93
|
+
# assert_equal({ text: 'how are you?' }, messages.last)
|
94
|
+
# end
|
88
95
|
#
|
89
|
-
|
96
|
+
def capture_broadcasts(stream, &block)
|
97
|
+
new_broadcasts_from(broadcasts(stream), stream, "capture_broadcasts", &block).map { |m| ActiveSupport::JSON.decode(m) }
|
98
|
+
end
|
99
|
+
|
100
|
+
# Asserts that the specified message has been sent to the stream.
|
90
101
|
#
|
91
|
-
#
|
92
|
-
# assert_broadcast_on('messages', text: 'hello') do
|
102
|
+
# def test_assert_transmitted_message
|
93
103
|
# ActionCable.server.broadcast 'messages', text: 'hello'
|
104
|
+
# assert_broadcast_on('messages', text: 'hello')
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# If a block is passed, that block should cause a message with the specified
|
108
|
+
# data to be sent.
|
109
|
+
#
|
110
|
+
# def test_assert_broadcast_on_again
|
111
|
+
# assert_broadcast_on('messages', text: 'hello') do
|
112
|
+
# ActionCable.server.broadcast 'messages', text: 'hello'
|
113
|
+
# end
|
94
114
|
# end
|
95
|
-
# end
|
96
115
|
#
|
97
116
|
def assert_broadcast_on(stream, data, &block)
|
98
|
-
# Encode to JSON and back–we want to use this value to compare
|
99
|
-
#
|
100
|
-
# Comparing JSON strings doesn't work due to the order if the keys.
|
117
|
+
# Encode to JSON and back–we want to use this value to compare with decoded
|
118
|
+
# JSON. Comparing JSON strings doesn't work due to the order if the keys.
|
101
119
|
serialized_msg =
|
102
120
|
ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(data))
|
103
121
|
|
104
122
|
new_messages = broadcasts(stream)
|
105
123
|
if block_given?
|
106
|
-
|
107
|
-
clear_messages(stream)
|
108
|
-
|
109
|
-
_assert_nothing_raised_or_warn("assert_broadcast_on", &block)
|
110
|
-
new_messages = broadcasts(stream)
|
111
|
-
clear_messages(stream)
|
112
|
-
|
113
|
-
# Restore all sent messages
|
114
|
-
(old_messages + new_messages).each { |m| pubsub_adapter.broadcast(stream, m) }
|
124
|
+
new_messages = new_broadcasts_from(new_messages, stream, "assert_broadcast_on", &block)
|
115
125
|
end
|
116
126
|
|
117
127
|
message = new_messages.find { |msg| ActiveSupport::JSON.decode(msg) == serialized_msg }
|
118
128
|
|
119
|
-
|
129
|
+
error_message = "No messages sent with #{data} to #{stream}"
|
130
|
+
|
131
|
+
if new_messages.any?
|
132
|
+
error_message = new_messages.inject("#{error_message}\nMessage(s) found:\n") do |error_message, new_message|
|
133
|
+
error_message + "#{ActiveSupport::JSON.decode(new_message)}\n"
|
134
|
+
end
|
135
|
+
else
|
136
|
+
error_message = "#{error_message}\nNo message found for #{stream}"
|
137
|
+
end
|
138
|
+
|
139
|
+
assert message, error_message
|
120
140
|
end
|
121
141
|
|
122
142
|
def pubsub_adapter # :nodoc:
|
@@ -126,8 +146,18 @@ module ActionCable
|
|
126
146
|
delegate :broadcasts, :clear_messages, to: :pubsub_adapter
|
127
147
|
|
128
148
|
private
|
129
|
-
def
|
130
|
-
|
149
|
+
def new_broadcasts_from(current_messages, stream, assertion, &block)
|
150
|
+
old_messages = current_messages
|
151
|
+
clear_messages(stream)
|
152
|
+
|
153
|
+
_assert_nothing_raised_or_warn(assertion, &block)
|
154
|
+
new_messages = broadcasts(stream)
|
155
|
+
clear_messages(stream)
|
156
|
+
|
157
|
+
# Restore all sent messages
|
158
|
+
(old_messages + new_messages).each { |m| pubsub_adapter.broadcast(stream, m) }
|
159
|
+
|
160
|
+
new_messages
|
131
161
|
end
|
132
162
|
end
|
133
163
|
end
|
data/lib/action_cable/version.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# :markup: markdown
|
4
|
+
|
3
5
|
require_relative "gem_version"
|
4
6
|
|
5
7
|
module ActionCable
|
6
|
-
# Returns the currently loaded version of Action Cable as a
|
8
|
+
# Returns the currently loaded version of Action Cable as a `Gem::Version`.
|
7
9
|
def self.version
|
8
10
|
gem_version
|
9
11
|
end
|
data/lib/action_cable.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright (c)
|
4
|
+
# Copyright (c) 37signals LLC
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
# a copy of this software and associated documentation files (the
|
@@ -25,10 +25,35 @@
|
|
25
25
|
|
26
26
|
require "active_support"
|
27
27
|
require "active_support/rails"
|
28
|
-
require "
|
28
|
+
require "zeitwerk"
|
29
29
|
|
30
|
+
# We compute lib this way instead of using __dir__ because __dir__ gives a real
|
31
|
+
# path, while __FILE__ honors symlinks. If the gem is stored under a symlinked
|
32
|
+
# directory, this matters.
|
33
|
+
lib = File.dirname(__FILE__)
|
34
|
+
|
35
|
+
Zeitwerk::Loader.for_gem.tap do |loader|
|
36
|
+
loader.ignore(
|
37
|
+
"#{lib}/rails", # Contains generators, templates, docs, etc.
|
38
|
+
"#{lib}/action_cable/gem_version.rb",
|
39
|
+
"#{lib}/action_cable/version.rb",
|
40
|
+
"#{lib}/action_cable/deprecator.rb",
|
41
|
+
)
|
42
|
+
|
43
|
+
loader.do_not_eager_load(
|
44
|
+
"#{lib}/action_cable/subscription_adapter", # Adapters are required and loaded on demand.
|
45
|
+
"#{lib}/action_cable/test_helper.rb",
|
46
|
+
Dir["#{lib}/action_cable/**/test_case.rb"]
|
47
|
+
)
|
48
|
+
|
49
|
+
loader.inflector.inflect("postgresql" => "PostgreSQL")
|
50
|
+
end.setup
|
51
|
+
|
52
|
+
# :markup: markdown
|
53
|
+
# :include: ../README.md
|
30
54
|
module ActionCable
|
31
|
-
|
55
|
+
require_relative "action_cable/version"
|
56
|
+
require_relative "action_cable/deprecator"
|
32
57
|
|
33
58
|
INTERNAL = {
|
34
59
|
message_types: {
|
@@ -41,7 +66,8 @@ module ActionCable
|
|
41
66
|
disconnect_reasons: {
|
42
67
|
unauthorized: "unauthorized",
|
43
68
|
invalid_request: "invalid_request",
|
44
|
-
server_restart: "server_restart"
|
69
|
+
server_restart: "server_restart",
|
70
|
+
remote: "remote"
|
45
71
|
},
|
46
72
|
default_mount_path: "/cable",
|
47
73
|
protocols: ["actioncable-v1-json", "actioncable-unsupported"].freeze
|
@@ -51,12 +77,4 @@ module ActionCable
|
|
51
77
|
module_function def server
|
52
78
|
@server ||= ActionCable::Server::Base.new
|
53
79
|
end
|
54
|
-
|
55
|
-
autoload :Server
|
56
|
-
autoload :Connection
|
57
|
-
autoload :Channel
|
58
|
-
autoload :RemoteConnections
|
59
|
-
autoload :SubscriptionAdapter
|
60
|
-
autoload :TestHelper
|
61
|
-
autoload :TestCase
|
62
80
|
end
|
@@ -1,13 +1,19 @@
|
|
1
1
|
Description:
|
2
|
-
============
|
3
2
|
Generates a new cable channel for the server (in Ruby) and client (in JavaScript).
|
4
3
|
Pass the channel name, either CamelCased or under_scored, and an optional list of channel actions as arguments.
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
bin/rails generate channel Chat speak
|
5
|
+
Examples:
|
6
|
+
`bin/rails generate channel notification`
|
9
7
|
|
10
|
-
creates a
|
11
|
-
Channel: app/channels/
|
12
|
-
Test: test/channels/
|
13
|
-
Assets: $JAVASCRIPT_PATH/channels/
|
8
|
+
creates a notification channel class, test and JavaScript asset:
|
9
|
+
Channel: app/channels/notification_channel.rb
|
10
|
+
Test: test/channels/notification_channel_test.rb
|
11
|
+
Assets: $JAVASCRIPT_PATH/channels/notification_channel.js
|
12
|
+
|
13
|
+
`bin/rails generate channel chat speak`
|
14
|
+
|
15
|
+
creates a chat channel with a speak action.
|
16
|
+
|
17
|
+
`bin/rails generate channel comments --no-assets`
|
18
|
+
|
19
|
+
creates a comments channel without JavaScript assets.
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# :markup: markdown
|
4
|
+
|
3
5
|
module Rails
|
4
6
|
module Generators
|
5
7
|
class ChannelGenerator < NamedBase
|
@@ -24,7 +26,7 @@ module Rails
|
|
24
26
|
|
25
27
|
if using_importmap?
|
26
28
|
pin_javascript_dependencies
|
27
|
-
elsif
|
29
|
+
elsif using_js_runtime?
|
28
30
|
install_javascript_dependencies
|
29
31
|
end
|
30
32
|
end
|
@@ -57,22 +59,26 @@ module Rails
|
|
57
59
|
def create_channel_javascript_file
|
58
60
|
channel_js_path = File.join("app/javascript/channels", class_path, "#{file_name}_channel")
|
59
61
|
js_template "javascript/channel", channel_js_path
|
60
|
-
gsub_file "#{channel_js_path}.js", /\.\/consumer/, "channels/consumer" unless
|
62
|
+
gsub_file "#{channel_js_path}.js", /\.\/consumer/, "channels/consumer" unless using_js_runtime?
|
61
63
|
end
|
62
64
|
|
63
65
|
def import_channels_in_javascript_entrypoint
|
64
66
|
append_to_file "app/javascript/application.js",
|
65
|
-
|
67
|
+
using_js_runtime? ? %(import "./channels"\n) : %(import "channels"\n)
|
66
68
|
end
|
67
69
|
|
68
70
|
def import_channel_in_javascript_entrypoint
|
69
71
|
append_to_file "app/javascript/channels/index.js",
|
70
|
-
|
72
|
+
using_js_runtime? ? %(import "./#{file_name}_channel"\n) : %(import "channels/#{file_name}_channel"\n)
|
71
73
|
end
|
72
74
|
|
73
75
|
def install_javascript_dependencies
|
74
76
|
say "Installing JavaScript dependencies", :green
|
75
|
-
|
77
|
+
if using_bun?
|
78
|
+
run "bun add @rails/actioncable"
|
79
|
+
elsif using_node?
|
80
|
+
run "yarn add @rails/actioncable"
|
81
|
+
end
|
76
82
|
end
|
77
83
|
|
78
84
|
def pin_javascript_dependencies
|
@@ -82,7 +88,6 @@ pin_all_from "app/javascript/channels", under: "channels"
|
|
82
88
|
RUBY
|
83
89
|
end
|
84
90
|
|
85
|
-
|
86
91
|
def file_name
|
87
92
|
@_file_name ||= super.sub(/_channel\z/i, "")
|
88
93
|
end
|
@@ -95,8 +100,19 @@ pin_all_from "app/javascript/channels", under: "channels"
|
|
95
100
|
@using_javascript ||= options[:assets] && root.join("app/javascript").exist?
|
96
101
|
end
|
97
102
|
|
103
|
+
def using_js_runtime?
|
104
|
+
@using_js_runtime ||= root.join("package.json").exist?
|
105
|
+
end
|
106
|
+
|
107
|
+
def using_bun?
|
108
|
+
# Cannot assume bun.lockb has been generated yet so we look for a file known to
|
109
|
+
# be generated by the jsbundling-rails gem
|
110
|
+
@using_bun ||= using_js_runtime? && root.join("bun.config.js").exist?
|
111
|
+
end
|
112
|
+
|
98
113
|
def using_node?
|
99
|
-
|
114
|
+
# Bun is the only runtime that _isn't_ node.
|
115
|
+
@using_node ||= using_js_runtime? && !root.join("bun.config.js").exist?
|
100
116
|
end
|
101
117
|
|
102
118
|
def using_importmap?
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actioncable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pratik Naik
|
8
8
|
- David Heinemeier Hansson
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 7.
|
20
|
+
version: 7.2.2.1
|
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: 7.
|
27
|
+
version: 7.2.2.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: actionpack
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 7.
|
34
|
+
version: 7.2.2.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 7.
|
41
|
+
version: 7.2.2.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: nio4r
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 0.6.1
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: zeitwerk
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.6'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.6'
|
70
84
|
description: Structure many real-time application concerns into channels over a single
|
71
85
|
WebSocket connection.
|
72
86
|
email:
|
@@ -83,7 +97,6 @@ files:
|
|
83
97
|
- app/assets/javascripts/actioncable.esm.js
|
84
98
|
- app/assets/javascripts/actioncable.js
|
85
99
|
- lib/action_cable.rb
|
86
|
-
- lib/action_cable/channel.rb
|
87
100
|
- lib/action_cable/channel/base.rb
|
88
101
|
- lib/action_cable/channel/broadcasting.rb
|
89
102
|
- lib/action_cable/channel/callbacks.rb
|
@@ -91,9 +104,9 @@ files:
|
|
91
104
|
- lib/action_cable/channel/periodic_timers.rb
|
92
105
|
- lib/action_cable/channel/streams.rb
|
93
106
|
- lib/action_cable/channel/test_case.rb
|
94
|
-
- lib/action_cable/connection.rb
|
95
107
|
- lib/action_cable/connection/authorization.rb
|
96
108
|
- lib/action_cable/connection/base.rb
|
109
|
+
- lib/action_cable/connection/callbacks.rb
|
97
110
|
- lib/action_cable/connection/client_socket.rb
|
98
111
|
- lib/action_cable/connection/identification.rb
|
99
112
|
- lib/action_cable/connection/internal_channel.rb
|
@@ -104,18 +117,17 @@ files:
|
|
104
117
|
- lib/action_cable/connection/tagged_logger_proxy.rb
|
105
118
|
- lib/action_cable/connection/test_case.rb
|
106
119
|
- lib/action_cable/connection/web_socket.rb
|
120
|
+
- lib/action_cable/deprecator.rb
|
107
121
|
- lib/action_cable/engine.rb
|
108
122
|
- lib/action_cable/gem_version.rb
|
109
123
|
- lib/action_cable/helpers/action_cable_helper.rb
|
110
124
|
- lib/action_cable/remote_connections.rb
|
111
|
-
- lib/action_cable/server.rb
|
112
125
|
- lib/action_cable/server/base.rb
|
113
126
|
- lib/action_cable/server/broadcasting.rb
|
114
127
|
- lib/action_cable/server/configuration.rb
|
115
128
|
- lib/action_cable/server/connections.rb
|
116
129
|
- lib/action_cable/server/worker.rb
|
117
130
|
- lib/action_cable/server/worker/active_record_connection_management.rb
|
118
|
-
- lib/action_cable/subscription_adapter.rb
|
119
131
|
- lib/action_cable/subscription_adapter/async.rb
|
120
132
|
- lib/action_cable/subscription_adapter/base.rb
|
121
133
|
- lib/action_cable/subscription_adapter/channel_prefix.rb
|
@@ -129,8 +141,8 @@ files:
|
|
129
141
|
- lib/action_cable/version.rb
|
130
142
|
- lib/rails/generators/channel/USAGE
|
131
143
|
- lib/rails/generators/channel/channel_generator.rb
|
132
|
-
- lib/rails/generators/channel/templates/application_cable/channel.rb
|
133
|
-
- lib/rails/generators/channel/templates/application_cable/connection.rb
|
144
|
+
- lib/rails/generators/channel/templates/application_cable/channel.rb.tt
|
145
|
+
- lib/rails/generators/channel/templates/application_cable/connection.rb.tt
|
134
146
|
- lib/rails/generators/channel/templates/channel.rb.tt
|
135
147
|
- lib/rails/generators/channel/templates/javascript/channel.js.tt
|
136
148
|
- lib/rails/generators/channel/templates/javascript/consumer.js.tt
|
@@ -142,12 +154,12 @@ licenses:
|
|
142
154
|
- MIT
|
143
155
|
metadata:
|
144
156
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
145
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.
|
146
|
-
documentation_uri: https://api.rubyonrails.org/v7.
|
157
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.2.2.1/actioncable/CHANGELOG.md
|
158
|
+
documentation_uri: https://api.rubyonrails.org/v7.2.2.1/
|
147
159
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
148
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.
|
160
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.2.2.1/actioncable
|
149
161
|
rubygems_mfa_required: 'true'
|
150
|
-
post_install_message:
|
162
|
+
post_install_message:
|
151
163
|
rdoc_options: []
|
152
164
|
require_paths:
|
153
165
|
- lib
|
@@ -155,15 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
167
|
requirements:
|
156
168
|
- - ">="
|
157
169
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
170
|
+
version: 3.1.0
|
159
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
172
|
requirements:
|
161
173
|
- - ">="
|
162
174
|
- !ruby/object:Gem::Version
|
163
175
|
version: '0'
|
164
176
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
177
|
+
rubygems_version: 3.5.22
|
178
|
+
signing_key:
|
167
179
|
specification_version: 4
|
168
180
|
summary: WebSocket framework for Rails.
|
169
181
|
test_files: []
|
data/lib/action_cable/channel.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActionCable
|
4
|
-
module Channel
|
5
|
-
extend ActiveSupport::Autoload
|
6
|
-
|
7
|
-
eager_autoload do
|
8
|
-
autoload :Base
|
9
|
-
autoload :Broadcasting
|
10
|
-
autoload :Callbacks
|
11
|
-
autoload :Naming
|
12
|
-
autoload :PeriodicTimers
|
13
|
-
autoload :Streams
|
14
|
-
autoload :TestCase
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|