@rails/actioncable 6.0.4 → 6.1.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.
- package/CHANGELOG.md +26 -220
- package/app/assets/javascripts/action_cable.js +1 -1
- package/package.json +2 -2
- package/src/connection_monitor.js +1 -1
- package/src/consumer.js +1 -1
- package/src/logger.js +12 -0
- package/src/subscriptions.js +3 -2
package/CHANGELOG.md
CHANGED
@@ -1,239 +1,45 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 6.0
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 6.0.3.6 (May 04, 2021) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 6.0.3.6 (March 26, 2021) ##
|
17
|
-
|
18
|
-
* No changes.
|
19
|
-
|
20
|
-
|
21
|
-
## Rails 6.0.3.5 (February 10, 2021) ##
|
22
|
-
|
23
|
-
* No changes.
|
24
|
-
|
25
|
-
|
26
|
-
## Rails 6.0.3.4 (October 07, 2020) ##
|
27
|
-
|
28
|
-
* No changes.
|
29
|
-
|
30
|
-
|
31
|
-
## Rails 6.0.3.3 (September 09, 2020) ##
|
32
|
-
|
33
|
-
* No changes.
|
34
|
-
|
35
|
-
|
36
|
-
## Rails 6.0.3.2 (June 17, 2020) ##
|
37
|
-
|
38
|
-
* No changes.
|
39
|
-
|
40
|
-
|
41
|
-
## Rails 6.0.3.1 (May 18, 2020) ##
|
42
|
-
|
43
|
-
* No changes.
|
44
|
-
|
45
|
-
|
46
|
-
## Rails 6.0.3 (May 06, 2020) ##
|
47
|
-
|
48
|
-
* No changes.
|
49
|
-
|
50
|
-
|
51
|
-
## Rails 6.0.2.2 (March 19, 2020) ##
|
52
|
-
|
53
|
-
* No changes.
|
54
|
-
|
55
|
-
|
56
|
-
## Rails 6.0.2.1 (December 18, 2019) ##
|
57
|
-
|
58
|
-
* No changes.
|
59
|
-
|
60
|
-
|
61
|
-
## Rails 6.0.2 (December 13, 2019) ##
|
62
|
-
|
63
|
-
* No changes.
|
64
|
-
|
65
|
-
|
66
|
-
## Rails 6.0.1 (November 5, 2019) ##
|
67
|
-
|
68
|
-
* No changes.
|
69
|
-
|
70
|
-
|
71
|
-
## Rails 6.0.0 (August 16, 2019) ##
|
72
|
-
|
73
|
-
* No changes.
|
6
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
74
7
|
|
8
|
+
* `ActionCable::Connection::Base` now allows intercepting unhandled exceptions
|
9
|
+
with `rescue_from` before they are logged, which is useful for error reporting
|
10
|
+
tools and other integrations.
|
75
11
|
|
76
|
-
|
12
|
+
*Justin Talbott*
|
77
13
|
|
78
|
-
*
|
79
|
-
|
80
|
-
|
81
|
-
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
82
|
-
|
83
|
-
* No changes.
|
84
|
-
|
85
|
-
|
86
|
-
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
87
|
-
|
88
|
-
* No changes.
|
89
|
-
|
90
|
-
|
91
|
-
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
92
|
-
|
93
|
-
* PostgreSQL subscription adapters now support `channel_prefix` option in cable.yml
|
94
|
-
|
95
|
-
Avoids channel name collisions when multiple apps use the same database for Action Cable.
|
96
|
-
|
97
|
-
*Vladimir Dementyev*
|
98
|
-
|
99
|
-
* Allow passing custom configuration to `ActionCable::Server::Base`.
|
100
|
-
|
101
|
-
You can now create a standalone Action Cable server with a custom configuration
|
102
|
-
(e.g. to run it in isolation from the default one):
|
103
|
-
|
104
|
-
```ruby
|
105
|
-
config = ActionCable::Server::Configuration.new
|
106
|
-
config.cable = { adapter: "redis", channel_prefix: "custom_" }
|
107
|
-
|
108
|
-
CUSTOM_CABLE = ActionCable::Server::Base.new(config: config)
|
109
|
-
```
|
110
|
-
|
111
|
-
Then you can mount it in the `routes.rb` file:
|
112
|
-
|
113
|
-
```ruby
|
114
|
-
Rails.application.routes.draw do
|
115
|
-
mount CUSTOM_CABLE => "/custom_cable"
|
116
|
-
# ...
|
117
|
-
end
|
118
|
-
```
|
119
|
-
|
120
|
-
*Vladimir Dementyev*
|
121
|
-
|
122
|
-
* Add `:action_cable_connection` and `:action_cable_channel` load hooks.
|
123
|
-
|
124
|
-
You can use them to extend `ActionCable::Connection::Base` and `ActionCable::Channel::Base`
|
125
|
-
functionality:
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
ActiveSupport.on_load(:action_cable_channel) do
|
129
|
-
# do something in the context of ActionCable::Channel::Base
|
130
|
-
end
|
131
|
-
```
|
14
|
+
* Add `ActionCable::Channel#stream_or_reject_for` to stream if record is present, otherwise reject the connection
|
132
15
|
|
133
|
-
*
|
16
|
+
*Atul Bhosale*
|
134
17
|
|
135
|
-
* Add `Channel
|
18
|
+
* Add `ActionCable::Channel#stop_stream_from` and `#stop_stream_for` to unsubscribe from a specific stream.
|
136
19
|
|
137
|
-
|
138
|
-
the `self.class.broadcast_to`.
|
20
|
+
*Zhang Kang*
|
139
21
|
|
140
|
-
|
22
|
+
* Add PostgreSQL subscription connection identificator.
|
141
23
|
|
142
|
-
|
24
|
+
Now you can distinguish Action Cable PostgreSQL subscription connections among others.
|
25
|
+
Also, you can set custom `id` in `cable.yml` configuration.
|
143
26
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
155
|
-
|
156
|
-
* [Rename npm package](https://github.com/rails/rails/pull/34905) from
|
157
|
-
[`actioncable`](https://www.npmjs.com/package/actioncable) to
|
158
|
-
[`@rails/actioncable`](https://www.npmjs.com/package/@rails/actioncable).
|
159
|
-
|
160
|
-
*Javan Makhmali*
|
161
|
-
|
162
|
-
* Merge [`action-cable-testing`](https://github.com/palkan/action-cable-testing) to Rails.
|
163
|
-
|
164
|
-
*Vladimir Dementyev*
|
165
|
-
|
166
|
-
* The JavaScript WebSocket client will no longer try to reconnect
|
167
|
-
when you call `reject_unauthorized_connection` on the connection.
|
168
|
-
|
169
|
-
*Mick Staugaard*
|
170
|
-
|
171
|
-
* `ActionCable.Connection#getState` now references the configurable
|
172
|
-
`ActionCable.adapters.WebSocket` property rather than the `WebSocket` global
|
173
|
-
variable, matching the behavior of `ActionCable.Connection#open`.
|
174
|
-
|
175
|
-
*Richard Macklin*
|
176
|
-
|
177
|
-
* The ActionCable javascript package has been converted from CoffeeScript
|
178
|
-
to ES2015, and we now publish the source code in the npm distribution.
|
179
|
-
|
180
|
-
This allows ActionCable users to depend on the javascript source code
|
181
|
-
rather than the compiled code, which can produce smaller javascript bundles.
|
182
|
-
|
183
|
-
This change includes some breaking changes to optional parts of the
|
184
|
-
ActionCable javascript API:
|
185
|
-
|
186
|
-
- Configuration of the WebSocket adapter and logger adapter have been moved
|
187
|
-
from properties of `ActionCable` to properties of `ActionCable.adapters`.
|
188
|
-
If you are currently configuring these adapters you will need to make
|
189
|
-
these changes when upgrading:
|
190
|
-
|
191
|
-
```diff
|
192
|
-
- ActionCable.WebSocket = MyWebSocket
|
193
|
-
+ ActionCable.adapters.WebSocket = MyWebSocket
|
194
|
-
```
|
195
|
-
```diff
|
196
|
-
- ActionCable.logger = myLogger
|
197
|
-
+ ActionCable.adapters.logger = myLogger
|
198
|
-
```
|
199
|
-
|
200
|
-
- The `ActionCable.startDebugging()` and `ActionCable.stopDebugging()`
|
201
|
-
methods have been removed and replaced with the property
|
202
|
-
`ActionCable.logger.enabled`. If you are currently using these methods you
|
203
|
-
will need to make these changes when upgrading:
|
204
|
-
|
205
|
-
```diff
|
206
|
-
- ActionCable.startDebugging()
|
207
|
-
+ ActionCable.logger.enabled = true
|
208
|
-
```
|
209
|
-
```diff
|
210
|
-
- ActionCable.stopDebugging()
|
211
|
-
+ ActionCable.logger.enabled = false
|
212
|
-
```
|
213
|
-
|
214
|
-
*Richard Macklin*
|
215
|
-
|
216
|
-
* Add `id` option to redis adapter so now you can distinguish
|
217
|
-
ActionCable's redis connections among others. Also, you can set
|
218
|
-
custom id in options.
|
219
|
-
|
220
|
-
Before:
|
221
|
-
```
|
222
|
-
$ redis-cli client list
|
223
|
-
id=669 addr=127.0.0.1:46442 fd=8 name= age=18 ...
|
224
|
-
```
|
225
|
-
|
226
|
-
After:
|
227
|
-
```
|
228
|
-
$ redis-cli client list
|
229
|
-
id=673 addr=127.0.0.1:46516 fd=8 name=ActionCable-PID-19413 age=2 ...
|
27
|
+
```sql
|
28
|
+
SELECT application_name FROM pg_stat_activity;
|
29
|
+
/*
|
30
|
+
application_name
|
31
|
+
------------------------
|
32
|
+
psql
|
33
|
+
ActionCable-PID-42
|
34
|
+
(2 rows)
|
35
|
+
*/
|
230
36
|
```
|
231
37
|
|
232
|
-
*
|
38
|
+
*Sergey Ponomarev*
|
233
39
|
|
234
|
-
*
|
40
|
+
* Subscription confirmations and rejections are now logged at the `DEBUG` level instead of `INFO`.
|
235
41
|
|
236
|
-
*
|
42
|
+
*DHH*
|
237
43
|
|
238
44
|
|
239
|
-
Please check [
|
45
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actioncable/CHANGELOG.md) for previous changes.
|
@@ -135,7 +135,7 @@
|
|
135
135
|
if (document.visibilityState === "visible") {
|
136
136
|
setTimeout(function() {
|
137
137
|
if (_this2.connectionIsStale() || !_this2.connection.isOpen()) {
|
138
|
-
logger.log("ConnectionMonitor reopening stale connection on visibilitychange.
|
138
|
+
logger.log("ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = " + document.visibilityState);
|
139
139
|
_this2.connection.reopen();
|
140
140
|
}
|
141
141
|
}, 200);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rails/actioncable",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.1.1",
|
4
4
|
"description": "WebSocket framework for Ruby on Rails.",
|
5
5
|
"main": "app/assets/javascripts/action_cable.js",
|
6
6
|
"files": [
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"bugs": {
|
22
22
|
"url": "https://github.com/rails/rails/issues"
|
23
23
|
},
|
24
|
-
"homepage": "
|
24
|
+
"homepage": "https://rubyonrails.org/",
|
25
25
|
"devDependencies": {
|
26
26
|
"babel-core": "^6.25.0",
|
27
27
|
"babel-plugin-external-helpers": "^6.22.0",
|
@@ -105,7 +105,7 @@ class ConnectionMonitor {
|
|
105
105
|
if (document.visibilityState === "visible") {
|
106
106
|
setTimeout(() => {
|
107
107
|
if (this.connectionIsStale() || !this.connection.isOpen()) {
|
108
|
-
logger.log(`ConnectionMonitor reopening stale connection on visibilitychange.
|
108
|
+
logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)
|
109
109
|
this.connection.reopen()
|
110
110
|
}
|
111
111
|
}
|
package/src/consumer.js
CHANGED
@@ -6,7 +6,7 @@ import Subscriptions from "./subscriptions"
|
|
6
6
|
// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription
|
7
7
|
// method.
|
8
8
|
//
|
9
|
-
// The following example shows how this can be
|
9
|
+
// The following example shows how this can be set up:
|
10
10
|
//
|
11
11
|
// App = {}
|
12
12
|
// App.cable = ActionCable.createConsumer("ws://example.com/accounts/1")
|
package/src/logger.js
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
import adapters from "./adapters"
|
2
2
|
|
3
|
+
// The logger is disabled by default. You can enable it with:
|
4
|
+
//
|
5
|
+
// ActionCable.logger.enabled = true
|
6
|
+
//
|
7
|
+
// Example:
|
8
|
+
//
|
9
|
+
// import * as ActionCable from '@rails/actioncable'
|
10
|
+
//
|
11
|
+
// ActionCable.logger.enabled = true
|
12
|
+
// ActionCable.logger.log('Connection Established.')
|
13
|
+
//
|
14
|
+
|
3
15
|
export default {
|
4
16
|
log(...messages) {
|
5
17
|
if (this.enabled) {
|
package/src/subscriptions.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import Subscription from "./subscription"
|
2
2
|
|
3
|
-
// Collection class for creating (and internally managing) channel subscriptions.
|
4
|
-
//
|
3
|
+
// Collection class for creating (and internally managing) channel subscriptions.
|
4
|
+
// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,
|
5
|
+
// and it should be called through the consumer like so:
|
5
6
|
//
|
6
7
|
// App = {}
|
7
8
|
// App.cable = ActionCable.createConsumer("ws://example.com/accounts/1")
|