aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/CHANGELOG.md153
-rw-r--r--actioncable/lib/action_cable/gem_version.rb4
-rw-r--r--actioncable/lib/action_cable/server/broadcasting.rb2
-rw-r--r--actioncable/lib/action_cable/server/worker.rb1
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/redis.rb4
-rw-r--r--actioncable/package.json2
-rw-r--r--actioncable/test/subscription_adapter/redis_test.rb4
7 files changed, 10 insertions, 160 deletions
diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md
index 9f312f8806..6fc2f17d32 100644
--- a/actioncable/CHANGELOG.md
+++ b/actioncable/CHANGELOG.md
@@ -1,154 +1,3 @@
-## Rails 6.0.0.beta3 (March 11, 2019) ##
-* No changes.
-
-## Rails 6.0.0.beta2 (February 25, 2019) ##
-
-* PostgreSQL subscription adapters now support `channel_prefix` option in cable.yml
-
- Avoids channel name collisions when multiple apps use the same database for Action Cable.
-
- *Vladimir Dementyev*
-
-* Allow passing custom configuration to `ActionCable::Server::Base`.
-
- You can now create a standalone Action Cable server with a custom configuration
- (e.g. to run it in isolation from the default one):
-
- ```ruby
- config = ActionCable::Server::Configuration.new
- config.cable = { adapter: "redis", channel_prefix: "custom_" }
-
- CUSTOM_CABLE = ActionCable::Server::Base.new(config: config)
- ```
-
- Then you can mount it in the `routes.rb` file:
-
- ```ruby
- Rails.application.routes.draw do
- mount CUSTOM_CABLE => "/custom_cable"
- # ...
- end
- ```
-
- *Vladimir Dementyev*
-
-* 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*
-
-* 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*
-
-
-## Rails 6.0.0.beta1 (January 18, 2019) ##
-
-* [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*
-
-* Merge [`action-cable-testing`](https://github.com/palkan/action-cable-testing) to Rails.
-
- *Vladimir Dementyev*
-
-* The JavaScript WebSocket client will no longer try to reconnect
- when you call `reject_unauthorized_connection` on the connection.
-
- *Mick Staugaard*
-
-* `ActionCable.Connection#getState` now references the configurable
- `ActionCable.adapters.WebSocket` property rather than the `WebSocket` global
- variable, matching the behavior of `ActionCable.Connection#open`.
-
- *Richard Macklin*
-
-* 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*
-
-* 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*
-
-* Rails 6 requires Ruby 2.5.0 or newer.
-
- *Jeremy Daer*, *Kasper Timm Hansen*
-
-
-Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/actioncable/CHANGELOG.md) for previous changes.
+Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actioncable/CHANGELOG.md) for previous changes.
diff --git a/actioncable/lib/action_cable/gem_version.rb b/actioncable/lib/action_cable/gem_version.rb
index 2be81736c6..6e7053e32e 100644
--- a/actioncable/lib/action_cable/gem_version.rb
+++ b/actioncable/lib/action_cable/gem_version.rb
@@ -8,9 +8,9 @@ module ActionCable
module VERSION
MAJOR = 6
- MINOR = 0
+ MINOR = 1
TINY = 0
- PRE = "beta3"
+ PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb
index bc54d784b3..b73cfa7d1f 100644
--- a/actioncable/lib/action_cable/server/broadcasting.rb
+++ b/actioncable/lib/action_cable/server/broadcasting.rb
@@ -40,7 +40,7 @@ module ActionCable
end
def broadcast(message)
- server.logger.debug "[ActionCable] Broadcasting to #{broadcasting}: #{message.inspect}"
+ server.logger.debug { "[ActionCable] Broadcasting to #{broadcasting}: #{message.inspect}" }
payload = { broadcasting: broadcasting, message: message, coder: coder }
ActiveSupport::Notifications.instrument("broadcast.action_cable", payload) do
diff --git a/actioncable/lib/action_cable/server/worker.rb b/actioncable/lib/action_cable/server/worker.rb
index 187c8f7939..b918d4ae72 100644
--- a/actioncable/lib/action_cable/server/worker.rb
+++ b/actioncable/lib/action_cable/server/worker.rb
@@ -66,7 +66,6 @@ module ActionCable
end
private
-
def logger
ActionCable.server.logger
end
diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb
index ad8fa52760..b4a9385c87 100644
--- a/actioncable/lib/action_cable/subscription_adapter/redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb
@@ -5,6 +5,8 @@ require "thread"
gem "redis", ">= 3", "< 5"
require "redis"
+require "active_support/core_ext/hash/except"
+
module ActionCable
module SubscriptionAdapter
class Redis < Base # :nodoc:
@@ -14,7 +16,7 @@ module ActionCable
# This is needed, for example, when using Makara proxies for distributed Redis.
cattr_accessor :redis_connector, default: ->(config) do
config[:id] ||= "ActionCable-PID-#{$$}"
- ::Redis.new(config.slice(:url, :host, :port, :db, :password, :id))
+ ::Redis.new(config.except(:adapter, :channel_prefix))
end
def initialize(*)
diff --git a/actioncable/package.json b/actioncable/package.json
index 4451afd17f..723aa63c81 100644
--- a/actioncable/package.json
+++ b/actioncable/package.json
@@ -1,6 +1,6 @@
{
"name": "@rails/actioncable",
- "version": "6.0.0-beta3",
+ "version": "6.1.0-alpha",
"description": "WebSocket framework for Ruby on Rails.",
"main": "app/assets/javascripts/action_cable.js",
"files": [
diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb
index 35840a4036..d4eb89719f 100644
--- a/actioncable/test/subscription_adapter/redis_test.rb
+++ b/actioncable/test/subscription_adapter/redis_test.rb
@@ -34,11 +34,11 @@ class RedisAdapterTest::AlternateConfiguration < RedisAdapterTest
end
class RedisAdapterTest::Connector < ActionCable::TestCase
- test "slices url, host, port, db, password and id from config" do
+ test "excludes adapter and channel prefix" do
config = { url: 1, host: 2, port: 3, db: 4, password: 5, id: "Some custom ID" }
assert_called_with ::Redis, :new, [ config ] do
- connect config.merge(other: "unrelated", stuff: "here")
+ connect config.merge(adapter: "redis", channel_prefix: "custom")
end
end