actioncable 7.2.3 → 8.0.0.beta1
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 +4 -88
- data/README.md +1 -1
- data/lib/action_cable/channel/base.rb +2 -8
- data/lib/action_cable/channel/streams.rb +0 -2
- data/lib/action_cable/connection/test_case.rb +5 -2
- 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 +6 -5
- data/lib/action_cable/subscription_adapter/redis.rb +3 -8
- metadata +14 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fbb636a677c963849f247b80e4b42f86c89925d34e326ddb0ec53745433e7ea
|
|
4
|
+
data.tar.gz: 7dc0e29e27c83651f099d3f3c2f2561ca2e01c37f9d543c9dbf258425576eb5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f771d4a87f7f3a599e36ce5f4f2648d6f312e4898b34d6709fd215fd64b65fa71b3ca768ef530069926c3aee88d32b15dffc323dff1fef13c2488ef1cbca83d
|
|
7
|
+
data.tar.gz: 7778ccb1dc1f864ec5b15d138f040e687d5d6efde6acbef35e45031338b83efcafbe33eed6ae8dcc17664825c42bda692e646c1ef4036f2f14bc040acc7f9b0c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,91 +1,7 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Add an `identifier` to the event payload for the ActiveSupport::Notification `transmit_subscription_confirmation.action_cable` and `transmit_subscription_rejection.action_cable`.
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
*Keith Schacht*
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*OuYangJinTing*
|
|
10
|
-
|
|
11
|
-
* Ensure the Postgresql adapter always use a dedicated connection even during system tests.
|
|
12
|
-
|
|
13
|
-
Fix an issue with the Action Cable Postgresql adapter causing deadlock or various weird
|
|
14
|
-
pg client error during system tests.
|
|
15
|
-
|
|
16
|
-
*Jean Boussier*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Rails 7.2.2.2 (August 13, 2025) ##
|
|
20
|
-
|
|
21
|
-
* No changes.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Rails 7.2.2.1 (December 10, 2024) ##
|
|
25
|
-
|
|
26
|
-
* No changes.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Rails 7.2.2 (October 30, 2024) ##
|
|
30
|
-
|
|
31
|
-
* No changes.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Rails 7.2.1.2 (October 23, 2024) ##
|
|
35
|
-
|
|
36
|
-
* No changes.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Rails 7.2.1.1 (October 15, 2024) ##
|
|
40
|
-
|
|
41
|
-
* No changes.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Rails 7.2.1 (August 22, 2024) ##
|
|
45
|
-
|
|
46
|
-
* No changes.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Rails 7.2.0 (August 09, 2024) ##
|
|
50
|
-
|
|
51
|
-
* Bring `ActionCable::Connection::TestCookieJar` in alignment with `ActionDispatch::Cookies::CookieJar` in regards to setting the cookie value.
|
|
52
|
-
|
|
53
|
-
Before:
|
|
54
|
-
|
|
55
|
-
```ruby
|
|
56
|
-
cookies[:foo] = { value: "bar" }
|
|
57
|
-
puts cookies[:foo] # => { value: "bar" }
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
After:
|
|
61
|
-
|
|
62
|
-
```ruby
|
|
63
|
-
cookies[:foo] = { value: "bar" }
|
|
64
|
-
puts cookies[:foo] # => "bar"
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
*Justin Ko*
|
|
68
|
-
|
|
69
|
-
* Record ping on every Action Cable message.
|
|
70
|
-
|
|
71
|
-
Previously only `ping` and `welcome` message types were keeping the connection active.
|
|
72
|
-
Now every Action Cable message updates the `pingedAt` value, preventing the connection
|
|
73
|
-
from being marked as stale.
|
|
74
|
-
|
|
75
|
-
*yauhenininjia*
|
|
76
|
-
|
|
77
|
-
* Add two new assertion methods for Action Cable test cases: `assert_has_no_stream`
|
|
78
|
-
and `assert_has_no_stream_for`.
|
|
79
|
-
|
|
80
|
-
These methods can be used to assert that a stream has been stopped, e.g. via
|
|
81
|
-
`stop_stream` or `stop_stream_for`. They complement the already existing
|
|
82
|
-
`assert_has_stream` and `assert_has_stream_for` methods.
|
|
83
|
-
|
|
84
|
-
```ruby
|
|
85
|
-
assert_has_no_stream "messages"
|
|
86
|
-
assert_has_no_stream_for User.find(42)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
*Sebastian Pöll*, *Junichi Sato*
|
|
90
|
-
|
|
91
|
-
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actioncable/CHANGELOG.md) for previous changes.
|
|
7
|
+
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 rails-core mailing list here:
|
|
23
23
|
|
|
24
24
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
|
@@ -166,7 +166,6 @@ module ActionCable
|
|
|
166
166
|
|
|
167
167
|
@reject_subscription = nil
|
|
168
168
|
@subscription_confirmation_sent = nil
|
|
169
|
-
@unsubscribed = false
|
|
170
169
|
|
|
171
170
|
delegate_connection_identifiers
|
|
172
171
|
end
|
|
@@ -202,16 +201,11 @@ module ActionCable
|
|
|
202
201
|
# cleanup with callbacks. This method is not intended to be called directly by
|
|
203
202
|
# the user. Instead, override the #unsubscribed callback.
|
|
204
203
|
def unsubscribe_from_channel # :nodoc:
|
|
205
|
-
@unsubscribed = true
|
|
206
204
|
run_callbacks :unsubscribe do
|
|
207
205
|
unsubscribed
|
|
208
206
|
end
|
|
209
207
|
end
|
|
210
208
|
|
|
211
|
-
def unsubscribed? # :nodoc:
|
|
212
|
-
@unsubscribed
|
|
213
|
-
end
|
|
214
|
-
|
|
215
209
|
private
|
|
216
210
|
# Called once a consumer has become a subscriber of the channel. Usually the
|
|
217
211
|
# place to set up any streams you want this channel to be sending to the
|
|
@@ -315,7 +309,7 @@ module ActionCable
|
|
|
315
309
|
unless subscription_confirmation_sent?
|
|
316
310
|
logger.debug "#{self.class.name} is transmitting the subscription confirmation"
|
|
317
311
|
|
|
318
|
-
ActiveSupport::Notifications.instrument("transmit_subscription_confirmation.action_cable", channel_class: self.class.name) do
|
|
312
|
+
ActiveSupport::Notifications.instrument("transmit_subscription_confirmation.action_cable", channel_class: self.class.name, identifier: @identifier) do
|
|
319
313
|
connection.transmit identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:confirmation]
|
|
320
314
|
@subscription_confirmation_sent = true
|
|
321
315
|
end
|
|
@@ -330,7 +324,7 @@ module ActionCable
|
|
|
330
324
|
def transmit_subscription_rejection
|
|
331
325
|
logger.debug "#{self.class.name} is transmitting the subscription rejection"
|
|
332
326
|
|
|
333
|
-
ActiveSupport::Notifications.instrument("transmit_subscription_rejection.action_cable", channel_class: self.class.name) do
|
|
327
|
+
ActiveSupport::Notifications.instrument("transmit_subscription_rejection.action_cable", channel_class: self.class.name, identifier: @identifier) do
|
|
334
328
|
connection.transmit identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:rejection]
|
|
335
329
|
end
|
|
336
330
|
end
|
|
@@ -88,8 +88,6 @@ 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
|
-
|
|
93
91
|
broadcasting = String(broadcasting)
|
|
94
92
|
|
|
95
93
|
# Don't send the confirmation until pubsub#subscribe is successful
|
|
@@ -75,8 +75,11 @@ module ActionCable
|
|
|
75
75
|
#
|
|
76
76
|
# ## Basic example
|
|
77
77
|
#
|
|
78
|
-
# Unit tests are written
|
|
79
|
-
#
|
|
78
|
+
# Unit tests are written as follows:
|
|
79
|
+
#
|
|
80
|
+
# 1. Simulate a connection attempt by calling `connect`.
|
|
81
|
+
# 2. Assert state, e.g. identifiers, has been assigned.
|
|
82
|
+
#
|
|
80
83
|
#
|
|
81
84
|
# class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
|
|
82
85
|
# 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,17 +35,18 @@ module ActionCable
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def with_subscriptions_connection(&block) # :nodoc:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
ar_conn = ActiveRecord::Base.connection_pool.checkout.tap do |conn|
|
|
39
|
+
# Action Cable is taking ownership over this database connection, and will
|
|
40
|
+
# perform the necessary cleanup tasks
|
|
41
|
+
ActiveRecord::Base.connection_pool.remove(conn)
|
|
42
|
+
end
|
|
42
43
|
pg_conn = ar_conn.raw_connection
|
|
43
44
|
|
|
44
45
|
verify!(pg_conn)
|
|
45
46
|
pg_conn.exec("SET application_name = #{pg_conn.escape_identifier(identifier)}")
|
|
46
47
|
yield pg_conn
|
|
47
48
|
ensure
|
|
48
|
-
ar_conn
|
|
49
|
+
ar_conn.disconnect!
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
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 ConnectionError
|
|
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
|
+
ConnectionError = ::Redis::BaseConnectionError
|
|
214
214
|
|
|
215
215
|
class SubscribedClient
|
|
216
216
|
def initialize(raw_client)
|
|
@@ -244,12 +244,7 @@ module ActionCable
|
|
|
244
244
|
SubscribedClient.new(conn._client)
|
|
245
245
|
end
|
|
246
246
|
else
|
|
247
|
-
|
|
248
|
-
::Redis::BaseConnectionError,
|
|
249
|
-
|
|
250
|
-
# Some older versions of redis-rb sometime leak underlying exceptions
|
|
251
|
-
RedisClient::ConnectionError,
|
|
252
|
-
].freeze
|
|
247
|
+
ConnectionError = RedisClient::ConnectionError
|
|
253
248
|
|
|
254
249
|
def extract_subscribed_client(conn)
|
|
255
250
|
conn
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actioncable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0.beta1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pratik Naik
|
|
8
8
|
- David Heinemeier Hansson
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: activesupport
|
|
@@ -16,28 +17,28 @@ dependencies:
|
|
|
16
17
|
requirements:
|
|
17
18
|
- - '='
|
|
18
19
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
+
version: 8.0.0.beta1
|
|
20
21
|
type: :runtime
|
|
21
22
|
prerelease: false
|
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
24
|
requirements:
|
|
24
25
|
- - '='
|
|
25
26
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
+
version: 8.0.0.beta1
|
|
27
28
|
- !ruby/object:Gem::Dependency
|
|
28
29
|
name: actionpack
|
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
|
30
31
|
requirements:
|
|
31
32
|
- - '='
|
|
32
33
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
+
version: 8.0.0.beta1
|
|
34
35
|
type: :runtime
|
|
35
36
|
prerelease: false
|
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
38
|
requirements:
|
|
38
39
|
- - '='
|
|
39
40
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
41
|
+
version: 8.0.0.beta1
|
|
41
42
|
- !ruby/object:Gem::Dependency
|
|
42
43
|
name: nio4r
|
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,11 +154,12 @@ licenses:
|
|
|
153
154
|
- MIT
|
|
154
155
|
metadata:
|
|
155
156
|
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/
|
|
157
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.beta1/actioncable/CHANGELOG.md
|
|
158
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
|
|
158
159
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
159
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
|
160
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/actioncable
|
|
160
161
|
rubygems_mfa_required: 'true'
|
|
162
|
+
post_install_message:
|
|
161
163
|
rdoc_options: []
|
|
162
164
|
require_paths:
|
|
163
165
|
- lib
|
|
@@ -165,14 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
165
167
|
requirements:
|
|
166
168
|
- - ">="
|
|
167
169
|
- !ruby/object:Gem::Version
|
|
168
|
-
version: 3.
|
|
170
|
+
version: 3.2.0
|
|
169
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
172
|
requirements:
|
|
171
173
|
- - ">="
|
|
172
174
|
- !ruby/object:Gem::Version
|
|
173
175
|
version: '0'
|
|
174
176
|
requirements: []
|
|
175
|
-
rubygems_version: 3.
|
|
177
|
+
rubygems_version: 3.5.16
|
|
178
|
+
signing_key:
|
|
176
179
|
specification_version: 4
|
|
177
180
|
summary: WebSocket framework for Rails.
|
|
178
181
|
test_files: []
|