actioncable 7.2.2.2 → 8.0.3
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 +24 -39
- data/README.md +1 -1
- data/lib/action_cable/channel/base.rb +8 -3
- data/lib/action_cable/channel/streams.rb +2 -0
- data/lib/action_cable/connection/identification.rb +0 -2
- data/lib/action_cable/connection/test_case.rb +2 -5
- data/lib/action_cable/gem_version.rb +4 -4
- data/lib/action_cable/remote_connections.rb +32 -33
- data/lib/action_cable/subscription_adapter/postgresql.rb +5 -6
- data/lib/action_cable/subscription_adapter/redis.rb +8 -3
- data/lib/rails/generators/channel/channel_generator.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5950ddf79b0417b9d031167d623e0ab30fdf9055847e31113e9c38cdd5f41ee
|
|
4
|
+
data.tar.gz: 1036c6f9afa0cef78179675a8a8c5e49074079364bde0fb71662fd8f31ec5ed8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4800620d87efb612cef53a992510aca7be81079f9a093f267fdf8b1ac03323103d465a3925de5524a7bf2cadb0ada6545f40f44d52d5f01c5696b9db97c99bb3
|
|
7
|
+
data.tar.gz: 86d543ad0837fa3fa617fddab3d34eb627e2443977c1249ecc02c5dbe8942b29af72481ca17089964b6194b0047c41f4e04a85bba8354aa2f78fe92c37592523
|
data/CHANGELOG.md
CHANGED
|
@@ -1,73 +1,58 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Fixed compatibility with `redis` gem `5.4.1`
|
|
4
4
|
|
|
5
|
+
*Jean Boussier*
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
* Fixed a possible race condition in `stream_from`.
|
|
7
8
|
|
|
8
|
-
*
|
|
9
|
+
*OuYangJinTing*
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
## Rails
|
|
12
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
12
13
|
|
|
13
14
|
* No changes.
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
## Rails
|
|
17
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
17
18
|
|
|
18
19
|
* No changes.
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
## Rails
|
|
22
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
22
23
|
|
|
23
|
-
*
|
|
24
|
+
* Ensure the Postgresql adapter always use a dedicated connection even during system tests.
|
|
24
25
|
|
|
26
|
+
Fix an issue with the Action Cable Postgresql adapter causing deadlock or various weird
|
|
27
|
+
pg client error during system tests.
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
*Jean Boussier*
|
|
27
30
|
|
|
28
|
-
* No changes.
|
|
29
31
|
|
|
32
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
* No changes.
|
|
32
35
|
|
|
33
|
-
* Bring `ActionCable::Connection::TestCookieJar` in alignment with `ActionDispatch::Cookies::CookieJar` in regards to setting the cookie value.
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
cookies[:foo] = { value: "bar" }
|
|
39
|
-
puts cookies[:foo] # => { value: "bar" }
|
|
40
|
-
```
|
|
39
|
+
* No changes.
|
|
41
40
|
|
|
42
|
-
After:
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
cookies[:foo] = { value: "bar" }
|
|
46
|
-
puts cookies[:foo] # => "bar"
|
|
47
|
-
```
|
|
42
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
* No changes.
|
|
50
45
|
|
|
51
|
-
* Record ping on every Action Cable message.
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
Now every Action Cable message updates the `pingedAt` value, preventing the connection
|
|
55
|
-
from being marked as stale.
|
|
47
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
56
48
|
|
|
57
|
-
|
|
49
|
+
* No changes.
|
|
58
50
|
|
|
59
|
-
* Add two new assertion methods for Action Cable test cases: `assert_has_no_stream`
|
|
60
|
-
and `assert_has_no_stream_for`.
|
|
61
51
|
|
|
62
|
-
|
|
63
|
-
`stop_stream` or `stop_stream_for`. They complement the already existing
|
|
64
|
-
`assert_has_stream` and `assert_has_stream_for` methods.
|
|
52
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
assert_has_no_stream "messages"
|
|
68
|
-
assert_has_no_stream_for User.find(42)
|
|
69
|
-
```
|
|
54
|
+
* Add an `identifier` to the event payload for the ActiveSupport::Notification `transmit_subscription_confirmation.action_cable` and `transmit_subscription_rejection.action_cable`.
|
|
70
55
|
|
|
71
|
-
*
|
|
56
|
+
*Keith Schacht*
|
|
72
57
|
|
|
73
|
-
Please check [7-
|
|
58
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actioncable/CHANGELOG.md) for previous changes.
|
data/README.md
CHANGED
|
@@ -19,6 +19,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
|
|
|
19
19
|
|
|
20
20
|
* https://github.com/rails/rails/issues
|
|
21
21
|
|
|
22
|
-
Feature requests should be discussed on the
|
|
22
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
23
23
|
|
|
24
24
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# :markup: markdown
|
|
4
4
|
|
|
5
|
-
require "set"
|
|
6
5
|
require "active_support/rescuable"
|
|
7
6
|
require "active_support/parameter_filter"
|
|
8
7
|
|
|
@@ -166,6 +165,7 @@ module ActionCable
|
|
|
166
165
|
|
|
167
166
|
@reject_subscription = nil
|
|
168
167
|
@subscription_confirmation_sent = nil
|
|
168
|
+
@unsubscribed = false
|
|
169
169
|
|
|
170
170
|
delegate_connection_identifiers
|
|
171
171
|
end
|
|
@@ -201,11 +201,16 @@ module ActionCable
|
|
|
201
201
|
# cleanup with callbacks. This method is not intended to be called directly by
|
|
202
202
|
# the user. Instead, override the #unsubscribed callback.
|
|
203
203
|
def unsubscribe_from_channel # :nodoc:
|
|
204
|
+
@unsubscribed = true
|
|
204
205
|
run_callbacks :unsubscribe do
|
|
205
206
|
unsubscribed
|
|
206
207
|
end
|
|
207
208
|
end
|
|
208
209
|
|
|
210
|
+
def unsubscribed? # :nodoc:
|
|
211
|
+
@unsubscribed
|
|
212
|
+
end
|
|
213
|
+
|
|
209
214
|
private
|
|
210
215
|
# Called once a consumer has become a subscriber of the channel. Usually the
|
|
211
216
|
# place to set up any streams you want this channel to be sending to the
|
|
@@ -309,7 +314,7 @@ module ActionCable
|
|
|
309
314
|
unless subscription_confirmation_sent?
|
|
310
315
|
logger.debug "#{self.class.name} is transmitting the subscription confirmation"
|
|
311
316
|
|
|
312
|
-
ActiveSupport::Notifications.instrument("transmit_subscription_confirmation.action_cable", channel_class: self.class.name) do
|
|
317
|
+
ActiveSupport::Notifications.instrument("transmit_subscription_confirmation.action_cable", channel_class: self.class.name, identifier: @identifier) do
|
|
313
318
|
connection.transmit identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:confirmation]
|
|
314
319
|
@subscription_confirmation_sent = true
|
|
315
320
|
end
|
|
@@ -324,7 +329,7 @@ module ActionCable
|
|
|
324
329
|
def transmit_subscription_rejection
|
|
325
330
|
logger.debug "#{self.class.name} is transmitting the subscription rejection"
|
|
326
331
|
|
|
327
|
-
ActiveSupport::Notifications.instrument("transmit_subscription_rejection.action_cable", channel_class: self.class.name) do
|
|
332
|
+
ActiveSupport::Notifications.instrument("transmit_subscription_rejection.action_cable", channel_class: self.class.name, identifier: @identifier) do
|
|
328
333
|
connection.transmit identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:rejection]
|
|
329
334
|
end
|
|
330
335
|
end
|
|
@@ -88,6 +88,8 @@ module ActionCable
|
|
|
88
88
|
# callback. Defaults to `coder: nil` which does no decoding, passes raw
|
|
89
89
|
# messages.
|
|
90
90
|
def stream_from(broadcasting, callback = nil, coder: nil, &block)
|
|
91
|
+
return if unsubscribed?
|
|
92
|
+
|
|
91
93
|
broadcasting = String(broadcasting)
|
|
92
94
|
|
|
93
95
|
# Don't send the confirmation until pubsub#subscribe is successful
|
|
@@ -75,11 +75,8 @@ module ActionCable
|
|
|
75
75
|
#
|
|
76
76
|
# ## Basic example
|
|
77
77
|
#
|
|
78
|
-
# Unit tests are written
|
|
79
|
-
#
|
|
80
|
-
# 1. Simulate a connection attempt by calling `connect`.
|
|
81
|
-
# 2. Assert state, e.g. identifiers, has been assigned.
|
|
82
|
-
#
|
|
78
|
+
# Unit tests are written by first simulating a connection attempt by calling
|
|
79
|
+
# `connect` and then asserting state, e.g. identifiers, have been assigned.
|
|
83
80
|
#
|
|
84
81
|
# class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
|
|
85
82
|
# def test_connects_with_proper_cookie
|
|
@@ -39,45 +39,44 @@ module ActionCable
|
|
|
39
39
|
RemoteConnection.new(server, identifier)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class
|
|
49
|
-
class InvalidIdentifiersError < StandardError; end
|
|
42
|
+
# # Action Cable Remote Connection
|
|
43
|
+
#
|
|
44
|
+
# Represents a single remote connection found via
|
|
45
|
+
# `ActionCable.server.remote_connections.where(*)`. Exists solely for the
|
|
46
|
+
# purpose of calling #disconnect on that connection.
|
|
47
|
+
class RemoteConnection
|
|
48
|
+
class InvalidIdentifiersError < StandardError; end
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
include Connection::Identification, Connection::InternalChannel
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
def initialize(server, ids)
|
|
53
|
+
@server = server
|
|
54
|
+
set_identifier_instance_vars(ids)
|
|
55
|
+
end
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
# Uses the internal channel to disconnect the connection.
|
|
58
|
+
def disconnect(reconnect: true)
|
|
59
|
+
server.broadcast internal_channel, { type: "disconnect", reconnect: reconnect }
|
|
60
|
+
end
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
# Returns all the identifiers that were applied to this connection.
|
|
63
|
+
redefine_method :identifiers do
|
|
64
|
+
server.connection_identifiers
|
|
65
|
+
end
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
protected
|
|
68
|
+
attr_reader :server
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
private
|
|
71
|
+
def set_identifier_instance_vars(ids)
|
|
72
|
+
raise InvalidIdentifiersError unless valid_identifiers?(ids)
|
|
73
|
+
ids.each { |k, v| instance_variable_set("@#{k}", v) }
|
|
74
|
+
end
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
def valid_identifiers?(ids)
|
|
77
|
+
keys = ids.keys
|
|
78
|
+
identifiers.all? { |id| keys.include?(id) }
|
|
79
|
+
end
|
|
80
|
+
end
|
|
82
81
|
end
|
|
83
82
|
end
|
|
@@ -35,18 +35,17 @@ module ActionCable
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def with_subscriptions_connection(&block) # :nodoc:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
38
|
+
# Action Cable is taking ownership over this database connection, and will
|
|
39
|
+
# perform the necessary cleanup tasks.
|
|
40
|
+
# We purposedly avoid #checkout to not end up with a pinned connection
|
|
41
|
+
ar_conn = ActiveRecord::Base.connection_pool.new_connection
|
|
43
42
|
pg_conn = ar_conn.raw_connection
|
|
44
43
|
|
|
45
44
|
verify!(pg_conn)
|
|
46
45
|
pg_conn.exec("SET application_name = #{pg_conn.escape_identifier(identifier)}")
|
|
47
46
|
yield pg_conn
|
|
48
47
|
ensure
|
|
49
|
-
ar_conn
|
|
48
|
+
ar_conn&.disconnect!
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
def with_broadcast_connection(&block) # :nodoc:
|
|
@@ -164,7 +164,7 @@ module ActionCable
|
|
|
164
164
|
begin
|
|
165
165
|
conn = @adapter.redis_connection_for_subscriptions
|
|
166
166
|
listen conn
|
|
167
|
-
rescue
|
|
167
|
+
rescue *CONNECTION_ERRORS
|
|
168
168
|
reset
|
|
169
169
|
if retry_connecting?
|
|
170
170
|
when_connected { resubscribe }
|
|
@@ -210,7 +210,7 @@ module ActionCable
|
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
if ::Redis::VERSION < "5"
|
|
213
|
-
|
|
213
|
+
CONNECTION_ERRORS = [::Redis::BaseConnectionError].freeze
|
|
214
214
|
|
|
215
215
|
class SubscribedClient
|
|
216
216
|
def initialize(raw_client)
|
|
@@ -244,7 +244,12 @@ module ActionCable
|
|
|
244
244
|
SubscribedClient.new(conn._client)
|
|
245
245
|
end
|
|
246
246
|
else
|
|
247
|
-
|
|
247
|
+
CONNECTION_ERRORS = [
|
|
248
|
+
::Redis::BaseConnectionError,
|
|
249
|
+
|
|
250
|
+
# Some older versions of redis-rb sometime leak underlying exceptions
|
|
251
|
+
RedisClient::ConnectionError,
|
|
252
|
+
].freeze
|
|
248
253
|
|
|
249
254
|
def extract_subscribed_client(conn)
|
|
250
255
|
conn
|
|
@@ -105,7 +105,7 @@ pin_all_from "app/javascript/channels", under: "channels"
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def using_bun?
|
|
108
|
-
# Cannot assume
|
|
108
|
+
# Cannot assume Bun lockfile has been generated yet so we look for a file known to
|
|
109
109
|
# be generated by the jsbundling-rails gem
|
|
110
110
|
@using_bun ||= using_js_runtime? && root.join("bun.config.js").exist?
|
|
111
111
|
end
|
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:
|
|
4
|
+
version: 8.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pratik Naik
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 8.0.3
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 8.0.3
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: actionpack
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 8.0.3
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 8.0.3
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: nio4r
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,10 +153,10 @@ licenses:
|
|
|
153
153
|
- MIT
|
|
154
154
|
metadata:
|
|
155
155
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
156
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
|
157
|
-
documentation_uri: https://api.rubyonrails.org/
|
|
156
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.3/actioncable/CHANGELOG.md
|
|
157
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.3/
|
|
158
158
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
159
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
|
159
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.3/actioncable
|
|
160
160
|
rubygems_mfa_required: 'true'
|
|
161
161
|
rdoc_options: []
|
|
162
162
|
require_paths:
|
|
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
165
165
|
requirements:
|
|
166
166
|
- - ">="
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
|
-
version: 3.
|
|
168
|
+
version: 3.2.0
|
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
171
|
- - ">="
|