2019-01-29 22:07:49 -05:00
|
|
|
* Add `:action_cable_connection` and `:action_cable_channel` load hooks.
|
|
|
|
|
|
|
|
You can use them to extend `ActionCable::Connection::Base` and `ActionCable::Channel::Base`
|
|
|
|
functionality:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
ActiveSupport.on_load(:action_cable_channel) do
|
|
|
|
# do something in the context of ActionCable::Channel::Base
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
|
|
|
*Vladimir Dementyev*
|
|
|
|
|
2019-01-22 15:06:16 -05:00
|
|
|
* Add `Channel::Base#broadcast_to`.
|
|
|
|
|
|
|
|
You can now call `broadcast_to` within a channel action, which equals to
|
|
|
|
the `self.class.broadcast_to`.
|
|
|
|
|
|
|
|
*Vladimir Dementyev*
|
|
|
|
|
|
|
|
* Make `Channel::Base.broadcasting_for` a public API.
|
|
|
|
|
|
|
|
You can use `.broadcasting_for` to generate a unique stream identifier within
|
|
|
|
a channel for the specified target (e.g. Active Record model):
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
ChatChannel.broadcasting_for(model) # => "chat:<model.to_gid_param>"
|
|
|
|
```
|
|
|
|
|
|
|
|
*Vladimir Dementyev*
|
|
|
|
|
|
|
|
|
2019-01-18 15:42:12 -05:00
|
|
|
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
|
|
|
|
2019-01-28 06:29:26 -05:00
|
|
|
* [Rename npm package](https://github.com/rails/rails/pull/34905) from
|
|
|
|
[`actioncable`](https://www.npmjs.com/package/actioncable) to
|
|
|
|
[`@rails/actioncable`](https://www.npmjs.com/package/@rails/actioncable).
|
|
|
|
|
|
|
|
*Javan Makhmali*
|
|
|
|
|
2019-01-13 22:58:47 -05:00
|
|
|
* Merge [`action-cable-testing`](https://github.com/palkan/action-cable-testing) to Rails.
|
|
|
|
|
|
|
|
*Vladimir Dementyev*
|
|
|
|
|
2018-10-11 16:47:16 -04:00
|
|
|
* The JavaScript WebSocket client will no longer try to reconnect
|
|
|
|
when you call `reject_unauthorized_connection` on the connection.
|
|
|
|
|
|
|
|
*Mick Staugaard*
|
|
|
|
|
2018-12-01 17:48:24 -05:00
|
|
|
* `ActionCable.Connection#getState` now references the configurable
|
|
|
|
`ActionCable.adapters.WebSocket` property rather than the `WebSocket` global
|
|
|
|
variable, matching the behavior of `ActionCable.Connection#open`.
|
|
|
|
|
2018-12-02 20:16:02 -05:00
|
|
|
*Richard Macklin*
|
|
|
|
|
Remove circular dependency warnings in ActionCable javascript and publish source modules with fine-grained exports (#34370)
* Replace several ActionCable.* references with finer-grained imports
This reduces the number of circular dependencies among the module
imports from 4:
```
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/connection.js -> app/javascript/action_cable/index.js
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/connection_monitor.js -> app/javascript/action_cable/index.js
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/consumer.js -> app/javascript/action_cable/index.js
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/subscriptions.js -> app/javascript/action_cable/index.js
```
to 2:
```
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/connection.js -> app/javascript/action_cable/index.js
(!) Circular dependency: app/javascript/action_cable/index.js -> app/javascript/action_cable/connection.js -> app/javascript/action_cable/connection_monitor.js -> app/javascript/action_cable/index.js
```
* Remove tests that only test javascript object property assignment
These tests really only assert that you can assign a property to
the ActionCable global object. That's true for pretty much any object
in javascript (it would only be false if the object has been frozen, or
has explicitly set some properties to be nonconfigurable).
* Refactor ActionCable to provide individual named exports
By providing individual named exports rather than a default export which
is an object with all of those properties, we enable applications to
only import the functions they need: any unused functions will be
removed via tree shaking.
Additionally, this restructuring removes the remaining circular
dependencies by extracting the separate adapters and logger modules, so
there are now no warnings when compiling the ActionCable bundle.
Note: This produces two small breaking API changes:
- The `ActionCable.WebSocket` getter and setter would be moved to
`ActionCable.adapters.WebSocket`. If a user is currently configuring
this, when upgrading they'd need to either add a delegated
getter/setter themselves, or change it like this:
```diff
- ActionCable.WebSocket = MyWebSocket
+ ActionCable.adapters.WebSocket = MyWebSocket
```
Applications which don't change the WebSocket adapter would not need
any changes for this when upgrading.
- Similarly, the `ActionCable.logger` getter and setter would be moved
to `ActionCable.adapters.logger`. If a user is currently configuring
this, when upgrading they'd need to either add a delegated
getter/setter themselves, or change it like this:
```diff
- ActionCable.logger = myLogger
+ ActionCable.adapters.logger = myLogger
```
Applications which don't change the logger would not need any changes
for this when upgrading.
These two aspects of the public API have to change because there's no
way to export a property setter for `WebSocket` (or `logger`) such that
this:
```js
import ActionCable from "actioncable"
ActionCable.WebSocket = MyWebSocket
```
would actually update `adapters.WebSocket`. (We can only offer that if
we have two separate source files like if `index.js` uses
`import * as ActionCable from "./action_cable" and then exports a
wrapper which has delegated getters and setters for those properties.)
This API change is very minor - it should be easy for applications to
add the `adapters.` prefix in their assignments or to patch in delegated
setters. And especially because most applications in the wild are not
ever changing the default value of `ActionCable.WebSocket` or
`ActionCable.logger` (because the default values are perfect), this API
breakage is worth the tree-shaking benefits we gain.
* Include source code in published actioncable npm package
This allows actioncable users to ship smaller javascript bundles to
visitors using modern browsers, as demonstrated in this repository:
https://github.com/rmacklin/actioncable-es2015-build-example
In that example, the bundle shrinks by 2.8K (25.2%) when you simply
change the actioncable import to point to the untranspiled src.
If you go a step further, like this:
```
diff --git a/app/scripts/main.js b/app/scripts/main.js
index 17bc031..1a2b2e0 100644
--- a/app/scripts/main.js
+++ b/app/scripts/main.js
@@ -1,6 +1,6 @@
-import ActionCable from 'actioncable';
+import * as ActionCable from 'actioncable';
let cable = ActionCable.createConsumer('wss://cable.example.com');
cable.subscriptions.create('AppearanceChannel', {
```
then the bundle shrinks by 3.6K (31.7%)!
In addition to allowing smaller bundles for those who ship untranspiled
code to modern browsers, including the source code in the published
package can be useful in other ways:
1. Users can import individual modules rather than the whole library
2. As a result of (1), users can also monkey patch parts of actioncable
by importing the relevant module, modifying the exported object, and
then importing the rest of actioncable (which would then use the
patched object).
Note: This is the same enhancement that we made to activestorage in
c0368ad090b79c19300a4aa133bb188b2d9ab611
* Remove unused commonjs & resolve plugins from ActionCable rollup config
These were added when we copied the rollup config from ActiveStorage,
but ActionCable does not have any commonjs dependencies (it doesn't have
any external dependencies at all), so these plugins are unnecessary here
* Change ActionCable.startDebugging() -> ActionCable.logger.enabled=true
and ActionCable.stopDebugging() -> ActionCable.logger.enabled=false
This API is simpler and more clearly describes what it does
* Change Travis configuration to run yarn install at the root for ActionCable builds
This is necessary now that the repository is using Yarn Workspaces
2018-12-01 16:25:02 -05:00
|
|
|
* The ActionCable javascript package has been converted from CoffeeScript
|
|
|
|
to ES2015, and we now publish the source code in the npm distribution.
|
|
|
|
|
|
|
|
This allows ActionCable users to depend on the javascript source code
|
|
|
|
rather than the compiled code, which can produce smaller javascript bundles.
|
|
|
|
|
|
|
|
This change includes some breaking changes to optional parts of the
|
|
|
|
ActionCable javascript API:
|
|
|
|
|
|
|
|
- Configuration of the WebSocket adapter and logger adapter have been moved
|
|
|
|
from properties of `ActionCable` to properties of `ActionCable.adapters`.
|
|
|
|
If you are currently configuring these adapters you will need to make
|
|
|
|
these changes when upgrading:
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- ActionCable.WebSocket = MyWebSocket
|
|
|
|
+ ActionCable.adapters.WebSocket = MyWebSocket
|
|
|
|
```
|
|
|
|
```diff
|
|
|
|
- ActionCable.logger = myLogger
|
|
|
|
+ ActionCable.adapters.logger = myLogger
|
|
|
|
```
|
|
|
|
|
|
|
|
- The `ActionCable.startDebugging()` and `ActionCable.stopDebugging()`
|
|
|
|
methods have been removed and replaced with the property
|
|
|
|
`ActionCable.logger.enabled`. If you are currently using these methods you
|
|
|
|
will need to make these changes when upgrading:
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- ActionCable.startDebugging()
|
|
|
|
+ ActionCable.logger.enabled = true
|
|
|
|
```
|
|
|
|
```diff
|
|
|
|
- ActionCable.stopDebugging()
|
|
|
|
+ ActionCable.logger.enabled = false
|
|
|
|
```
|
|
|
|
|
|
|
|
*Richard Macklin*
|
|
|
|
|
2018-09-05 09:54:44 -04:00
|
|
|
* Add `id` option to redis adapter so now you can distinguish
|
|
|
|
ActionCable's redis connections among others. Also, you can set
|
|
|
|
custom id in options.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
```
|
|
|
|
$ redis-cli client list
|
|
|
|
id=669 addr=127.0.0.1:46442 fd=8 name= age=18 ...
|
|
|
|
```
|
|
|
|
|
|
|
|
After:
|
|
|
|
```
|
|
|
|
$ redis-cli client list
|
|
|
|
id=673 addr=127.0.0.1:46516 fd=8 name=ActionCable-PID-19413 age=2 ...
|
|
|
|
```
|
|
|
|
|
|
|
|
*Ilia Kasianenko*
|
|
|
|
|
2018-12-19 15:09:34 -05:00
|
|
|
* Rails 6 requires Ruby 2.5.0 or newer.
|
2018-02-17 16:02:18 -05:00
|
|
|
|
2018-12-19 15:09:34 -05:00
|
|
|
*Jeremy Daer*, *Kasper Timm Hansen*
|
2017-11-28 00:01:45 -05:00
|
|
|
|
|
|
|
|
2018-01-30 18:51:17 -05:00
|
|
|
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actioncable/CHANGELOG.md) for previous changes.
|