Commit Graph

612 Commits

Author SHA1 Message Date
Akira Matsuda
5473e390d3 self. is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
2017-01-05 19:58:52 +09:00
Rafael França
a27c040cc3 Merge pull request #25626 from maclover7/jm-standardize-ac-readme
Standardize Action Cable README.md
2017-01-03 19:35:39 -05:00
Jon Moss
37d956f45f Bump license years for 2017
Per https://www.timeanddate.com/counters/firstnewyear.html, it's already
2017 in a lot of places, so we should bump the Rails license years to
2017.

[ci skip]
2016-12-31 08:34:08 -05:00
Tony Arcieri
c434b97628 Upgrade to nio4r 2.0.0
nio4r 2.0.0 primarily includes new features and bugfixes, with few breaking
changes. The primary reason for bumping the major version is dropping support
for all Ruby versions prior to 2.2.2, so as to match Rails 5.

Full release announcement here:

https://groups.google.com/forum/#!topic/socketry/ZDIUj1ufiJ8
2016-12-28 19:45:39 -08:00
Jon Moss
d99c772da0 Small edits to actioncable/CHANGELOG.md
[ci skip]

- capitalize WebSocket
2016-12-27 08:41:28 -05:00
Akira Matsuda
91fa2b71c3 Privatize unneededly protected methods in Action Cable 2016-12-24 22:16:43 +09:00
Akira Matsuda
79c17a2d91 Privatize unneededly protected methods in Action Cable tests 2016-12-24 00:15:24 +09:00
Akira Matsuda
21e5fd4a2a Describe what we are protecting 2016-12-23 23:48:54 +09:00
Carlos Eduardo Monti
2b39b5bfa1 Fix typo in channel generator usage message 2016-12-19 12:31:42 -03:00
MSP-Greg
7257306623 ActionCable::Connection::Base doc code sample syntax error 2016-12-06 10:35:36 -06:00
Matthew Draper
162e889f16 Prevent race condition when launching EventMachine reactor
reactor_running? will be true just after the thread enters
EventMachine.run; reactor_thread only gets set after the internal
initialize_event_machine method has been called, the C extension is set
up, and it is entering its run loop.
2016-11-30 22:55:04 +10:30
Javan Makhmali
7083fa27a4 Add more Action Cable JavaScript tests 2016-11-21 09:50:00 -05:00
yuuji.yaginuma
7c7f4f96df use correct value in example [ci skip]
Need to specify `reload` from turbolinks 5.
Ref: 7225f0bb9fd1d71a7a37b53815c90178cc7319bd
2016-11-14 09:45:28 +09:00
Vipul A M
7e7d6ccf34
Changelog edits 2016-11-12 13:14:49 -05:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Charles Oliver Nutter
51de32b2ec Lazy-load blade for actioncable tests; no blade on JRuby. 2016-10-21 17:19:44 -05:00
Matthew Draper
dae4044734 Permit same-origin connections by default
WebSocket always defers the decision to the server, because it didn't
have to deal with legacy compatibility... but the same-origin policy is
still a reasonable default.

Origin checks do not protect against a directly connecting attacker --
they can lie about their host, but can also lie about their origin.
Origin checks protect against a connection from 3rd-party controlled
script in a context where a victim browser's cookies will be passed
along. And if an attacker has breached that protection, they've already
compromised the HTTP session, so treating the WebSocket connection in
the same way seems reasonable.

In case this logic proves incorrect (or anyone just wants to be more
paranoid), we retain a config option to disable it.
2016-10-11 12:51:10 +10:30
Matthew Draper
f8c53eff7b Merge pull request #26568 from skateman/cable-sameorigin-as-host
Optionally allow ActionCable requests from the same host as origin
2016-10-11 12:28:38 +10:30
Matthew Draper
3a11c5b626 Merge pull request #26714 from matthewd/close-race
Work around read/close race (x2)
2016-10-07 04:30:08 +10:30
Matthew Draper
1fe967d0c9 Wait for the socket to be closed asynchronously 2016-10-06 13:12:35 +10:30
Matthew Draper
acd7ba795e Use a branch of websocket-client-simple, to work around read/close race 2016-10-06 12:51:26 +10:30
Matthew Draper
4a7c5685c8 Close the IO from the read loop thread
IO#close and IO#read across threads don't get along so well:

After T1 enters #read and releases the GVL, T2 can call #close on the
IO, thereby both closing the fd and freeing the buffer while T1 is using
them.
2016-10-06 10:31:14 +10:30
kenta-s
a0f871f95a Change page:change to turbolinks:load in README.md [ci skip] 2016-10-05 19:41:27 +09:00
Matthew Draper
39fb3069f8 Don't shut down adapters that haven't been set
We hit when we skip the PostgreSQL adapter.
2016-10-04 06:40:38 +10:30
Matthew Draper
a92fa72600 Shut down the worker pool - don't kill it
Different parts of concurrent-ruby's documentation make inconsistent
claims about how kill will behave. It doesn't do the thing we want.
2016-10-03 05:38:25 +10:30
Jon Moss
d1cc11a360 Add tests for Server::Base#restart 2016-10-02 09:02:01 -04:00
Jon Moss
35a497dc29 Move behavior to Server::Base, and flush pubsub 2016-10-02 08:45:38 -04:00
Jon Moss
a5dfba4135 Shutdown pubsub connection before classes are reloaded
Before this patch, if you were to make a file edit in your Rails
application and you tried to load up the page, it would hang
indefinitely. The issue is that Active Record is trying to cleanup after
itself and clear all active connection, but Action Cable is still
holding onto a connection from the pool. To resolve this, we are now
shutting down the pubsub adapter before classes are reloaded, to avoid
this altogether (connection is being returned to the pool).

Credits to @skateman for discovering this bug. :)
2016-10-02 08:45:38 -04:00
Matthew Draper
7c812c2401 Use websocket-client-simple instead of Faye as a websockets client
Mostly, this is just to avoid EventMachine. But there's also an argument
to be made that we're better off using a different protocol library for
our test suite than the one we use to implement the server.
2016-10-02 12:25:33 +10:30
Matthew Draper
a5abc310cd Shut down EventMachine before re-enabling warnings 2016-10-02 12:25:33 +10:30
Matthew Draper
3e779d3c67 In-line the configuration points that only existed for Faye support 2016-10-01 15:36:26 +09:30
Matthew Draper
d44177d45e Remove Faye mode
No deprecation, because it was never documented.
2016-10-01 15:35:59 +09:30
Matthew Draper
9588a3d66d Merge pull request #26547 from palkan/fix/actioncable-confirmation-race-condition
Avoid race condition on subscription confirmation
2016-10-01 15:18:39 +09:30
Matthew Draper
5d92089bca Buffer writes to the cable sockets
Otherwise, they can sometimes block, leading to reduced system
throughput.
2016-09-28 06:44:23 +09:30
palkan
3e68d8b872 Add Channel#ensure_confirmation_sent; call #subscribe_to_channel after initializing 2016-09-22 20:25:09 +03:00
Dávid Halász
268c340b09 Optionally allow ActionCable requests from the same host as origin
When the `allow_same_origin_as_host` is set to `true`, the request
forgery protection permits `HTTP_ORIGIN` values starting with the
corresponding `proto://` prefix followed by `HTTP_HOST`. This way
it is not required to specify the list of allowed URLs.
2016-09-21 16:10:46 +02:00
palkan
03a209e92a [Fix #25381] Avoid race condition on subscription confirmation 2016-09-20 19:42:24 +03:00
Prathamesh Sonpatki
f838c213be
[ci skip] Fix formatting of documentation of worker_pool method from AC::Server::Base 2016-09-07 12:05:36 +05:30
Prathamesh Sonpatki
0c9ef8d943
[ci skip] Fix formatting in Action Cable Connection::Base module docs 2016-09-07 08:04:52 +05:30
Prathamesh Sonpatki
c683ac4fe0
[ci fix] Fix API documentation for Streams module from Action Cable 2016-09-06 23:10:15 +05:30
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Jon Moss
831e2c8d1b Prevent invocation of channel action if rejected connection
Fixes #23757.

Before this commit, even if `reject` was called in the `subscribe`
method for an Action Cable channel, all actions on that channel could
still be invoked. This calls a `return` if a rejected connection tries
to invoke any actions on the channel.
2016-08-19 13:00:39 -04:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Vipul A M
8b984161d6
Pass over changelogs [ci skip] 2016-08-10 09:33:13 +05:30
Xavier Noria
46f511685c revises more Lint/EndAlignment offenses 2016-08-08 18:25:11 +02:00
Xavier Noria
cf082927ef copy-edits an exception message
Inserted spaces in the name of Rails components.

Since I was on it, also used PostgreSQL instead of Postgres
because albeit Postgres is an accepted alias, PostgreSQL is
the official name and the actual name of the adapter.

See

    https://wiki.postgresql.org/wiki/ProjectName

with regard to PostgreSQL vs Postgres.
2016-08-07 22:58:20 +02:00
Ryuta Kamizono
762e3f05f3 Add Style/EmptyLines in .rubocop.yml and remove extra empty lines 2016-08-07 17:50:59 +09:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
12a70404cd modernizes hash syntax in actioncable 2016-08-06 19:32:32 +02:00
Xavier Noria
e6ab70c439 applies new string literal convention to the rest of the project
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:28:46 +02:00
Xavier Noria
adca8154c6 applies new string literal convention in the gemspecs
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:27:12 +02:00
Xavier Noria
f8477f13bf applies new string literal convention in actioncable/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:15:15 +02:00
Xavier Noria
b678eb57e9 applies new string literal convention in actioncable/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:13:46 +02:00
Santosh Wadghule
e73b5cf51b Give importance to rails command in the comment section. 2016-07-13 19:13:05 +05:30
Matthew Draper
48e8056d4f Correct changelog layout
[ci skip]
2016-07-09 03:17:51 +09:30
Matthew Draper
e995611155 Insert changelog entry for #25615 2016-07-09 02:56:03 +09:30
Matthew Draper
92421ee2d2 Merge pull request #25624 from tinco/actioncable_write_race
Fix race condition in websocket stream write
2016-07-09 02:44:15 +09:30
Matthew Draper
08a9074613 Merge pull request #24988 from mwear/action_cable_broadcast_notifications
Add ActiveSupport::Notifications hook to ActionCable::Server.broadcast
2016-07-04 08:44:14 +09:30
Matthew Draper
550303c05c Merge pull request #25030 from mmmpa/pull_request
ActionCable, sometimes add_channel is not called.
2016-07-04 08:39:02 +09:30
Matthew Draper
a468774cc1 Merge pull request #25293 from y-yagi/remove_needless_comments
remove needless comments
2016-07-03 04:08:30 +09:30
Jon Moss
eff98450ff Standardize Action Cable README.md
All other Rails components feature this section, Action Cable should
have it as well.

[ci skip]
2016-07-02 12:13:33 -04:00
Tinco Andringa
3120b51de7 close hijacked i/o socket after use (fixes #25613) 2016-07-01 23:03:30 +02:00
Tinco Andringa
ce5f9bb2a5 fix race condition in websocket stream write 2016-07-01 15:29:29 +02:00
Jeremy Daer
ba9571e1ac
Periodic timers: delegate async instance_exec to the worker pool 2016-06-29 23:37:07 -07:00
Vipul A M
e5c5b6f2ee Merge pull request #24991 from maclover7/actioncable-npm-docs
Add documentation about Action Cable npm package
2016-06-29 15:29:59 -07:00
Kasper Timm Hansen
754e5bdf87 Make client test run individually.
Require our dependency and forgo the core ext version.
2016-06-28 18:54:30 +02:00
Rafael Mendonça França
e78e0e2a42
Fix Action Cable README [ci skip] 2016-06-26 16:09:36 -03:00
Ryuta Kamizono
e317e5e1e1 Remove conflict line [ci skip] 2016-06-27 02:52:39 +09:00
Vijay Dev
5343626ea8 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	actioncable/README.md
2016-06-26 16:34:23 +00:00
Gaurav Sharma
4db92eed3b client test have not using Pathname and hashwithindifferent access 2016-06-26 01:49:54 +05:30
Michael Dever
0a8584456e Allow actioncable connections from any port in development 2016-06-16 21:04:43 +01:00
Vipul A M
b94b04b1d1
Fix and make example generic in README as well [ci skip] 2016-06-15 22:04:56 -07:00
yuuji.yaginuma
8a5f17e55a remove needless comments
Follow up to #25240.
2016-06-06 15:09:06 +09:00
Prathamesh Sonpatki
7d4b33257b
Added "Download and Installation" section to Action Cable README [ci skip]
- Only Action Cable README did not have this section, all of the other
  READMEs have this section.
2016-06-04 16:06:35 -04:00
Prathamesh Sonpatki
4c192a7fad
Trim Action Cable README [ci skip]
- Remove "Configuration", "Running the server", "Dependencies" and "Deployment"
  sections from the Action Cable README as they are already duplicated in the
  Action Cable overview guide.
2016-06-04 16:01:30 -04:00
Matthew Draper
a8df1bc345 Properly support reloading for Action Cable channels 2016-06-02 04:08:48 +09:30
Jeremy Daer
8932c1b9a4
Merge pull request #25170 from maclover7/add-configuration-cable
[Action Cable] Add `WebSocket` and `logger` configuration options
2016-05-31 11:19:29 -07:00
Javan Makhmali
410a32ffbd Add helper for testing against a mock WebSocket and server 2016-05-31 13:06:11 -04:00
Jon Moss
fb0f0c7f6e Reorganize MockWebSocket 2016-05-31 13:06:11 -04:00
Jon Moss
66901c1849 Add configuration for WebSocket and logger
[Javan Makhmali, Jon Moss]
2016-05-31 13:06:08 -04:00
Jeremy Daer
0419e1b6f3
Merge pull request #25216 from javan/actioncable/tune-sauce-labs-tests
Action Cable: Tune Sauce Labs tests
2016-05-31 08:57:19 -07:00
Javan Makhmali
a051e59fb9 Test single latest browser version
Cuts down the number of concurrent Sauce Labs VMs we need to spin up. Can add specific versions back in to target regressions if need be.
2016-05-31 10:42:18 -04:00
Rajat Bansal
72a0f5e24c fix grammar 2016-05-31 13:31:18 +05:30
Anubhav Saxena
5983226161 Bash markdown syntax
Added 'sh' for markdown formatting as bash.
2016-05-27 08:58:55 +05:30
Jon Moss
1713075a80 Add documentation about Action Cable npm package
Sorry, forgot to include in my main PR :(

[ci skip]

[Jon Moss, Zach Schneider]
2016-05-26 22:22:04 -04:00
mmmpa
711d232f93 Add guard to broadcast. 2016-05-26 05:22:56 +09:00
Jon Moss
8cfce058d9
CI: run Action Cable browser tests in Sauce Labs
Allow failures until test runs are consistently stable, not hanging.

Closes #24943.

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-05-25 09:21:28 -07:00
Javan Makhmali
d12209cad2 Remove package:clean task
Introduced in d6f2000a67cc63aa67414c75ce77de671824ec52 and was only used by Action Cable. Now handled by Action Cable’s assets:compile task.
2016-05-24 13:11:28 -04:00
Javan Makhmali
11078dddbb Build action_cable.js with Blade 2016-05-24 13:11:10 -04:00
Vipul A M
61483b18bc
Remove Blade gem dependency
Apps that depend on Action Cable don't need Blade for app development,
so we can remove the gem dependency.

We do need Blade for Action Cable dev, so we bundle it in the Gemfile.

Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-05-21 12:41:01 -07:00
Sean Griffin
26c0e2cab4 Merge pull request #25076 from jeroenvisser101/keep-to-max-length
Change comments to not exceed 80 characters
2016-05-21 14:56:03 -04:00
Jon Moss
c420bedda7 Pass over Action Cable docs
[ci skip]
2016-05-21 11:55:04 -04:00
Rafael França
db312a9fb0 Merge pull request #24918 from prathamesh-sonpatki/cable-assets
Cable: Generate .js or .coffee files while generating channel as per the javascript engine of the application
2016-05-21 08:52:43 -03:00
Jeroen Visser
ee25897230
Change comments to not exceed 80 characters
Other generated files do keep to this, but action cable doesn't.
2016-05-19 15:37:50 +02:00
Roman Pushkin
a3c4d035f0 Improve method description
Method description improved to reflect little bit more complicated scenario when names are camel-cased.
2016-05-18 14:12:11 -07:00
Prathamesh Sonpatki
63ac6255ba
Cable: Generate .js or .coffee files while generating channel as per the javascript engine of the application
- Now we will detect what javascript engine user is using and based on
  that we will generate either `.js` or `.coffee` version of the channel
  file.
- This also needs a change in coffee-rails to override the `js_template`
  method. Related PR https://github.com/rails/coffee-rails/pull/72.
- Currently coffee-rails gem sets
  `config.app_generators.javascript_engine` to `:coffee` and using this
  information we override the `js_template` to set the extension as
  `.coffee` in coffee-rails gem.
- Using this approach, we can keep the `channel.js` and `channel.coffee`
  files in the Rails repository itself.
- Additionally the `js_template` method can act as public interface for
  coffee-rails gem to hook into and change the extension to `.coffee`
  without maintaining the actual asset files.

[Prathamesh Sonpatki, Matthew Draper]
2016-05-17 18:12:19 +05:30
Vijay Dev
83ecf3fe56 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/configuring.md
2016-05-14 09:54:23 +00:00
Matthew Wear
f3ba0c1dd3 Add ActiveSupport::Notifications hook to Broadcaster#broadcast
This addition of this notification hook will give users better visibility
into the messages being sent over the PubSub adapter.
2016-05-12 10:56:35 -07:00
Jon Moss
548c1d6e8b
Publish Action Cable to NPM when we release.
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-05-11 19:36:27 -07:00
Rafael Mendonça França
8ecc5ab1d8 Start Rails 5.1 development 🎉 2016-05-10 03:46:56 -03:00
Javan Makhmali
71d4066972 Kick off initial JavaScript tests 2016-05-09 09:36:53 -04:00
yuuji.yaginuma
017c7f46e0 change cable.coffee to cable.js [ci skip]
In #23935, cable file was to be provided by the javascript instead of coffeescript,
doc was also been modified to use javascript.
2016-05-07 21:15:33 +02:00
Matthew Draper
33f8dac38b Merge commit 'fbdcf5221ad7ea3d40ad09651962fc85d101dd67'
Preparing for 5.0.0.rc1 release
2016-05-07 11:50:04 -05:00
Jon Moss
7d55c846f1 http --> https
[ci skip]
2016-05-06 17:59:27 -04:00
Rafael Mendonça França
fbdcf5221a Preparing for 5.0.0.rc1 release 2016-05-06 16:54:40 -05:00
Xavier Noria
1dcf280014 renames ActionCable::Railtie to ActionCable::Engine
This is an engine living in action_cable/engine.rb, convention is to
call these things *::Engine.

Looking at thi git history looks like the current *::Railtie was just
an accident.
2016-05-04 06:47:57 -05:00
Jay Hayes
43cb7acc01 Fix code formatting in docs 2016-05-03 11:37:17 -05:00
willnet
11d41c6ef8 [ci skip] Fix ActionCable README
default worker pool size was changed from 100 to 4 at #24376
2016-05-02 23:33:12 +09:00
eileencodes
f7a986012a Prep Rails 5 beta 4 2016-04-27 15:48:47 -05:00
Vipul A M
f0a2edc7fc Merge pull request #24669 from tomkadwill/action_pack_typos
Actioncable and Actionpack documentation typos [ci skip]
2016-04-22 02:07:29 +05:30
Tom Kadwill
5646895b7f Actioncable and Actionpack documentation typos [ci skip] 2016-04-21 21:32:06 +01:00
Vipul A M
e7f921d405 Log if redis connection is in stale/failed state. 2016-04-21 22:13:55 +05:30
Jeremy Daer
3ba0eec20c
Cable: Extract stream handler construction
* Use separate stream handler builders for easy override and testing.
* Fix worker pool execution that was silently failing since it only
  expected connection receivers.

Sparked by code in #24162.
2016-04-18 23:29:51 -07:00
Jeremy Daer
983b743c8c
Cable: Periodic timers refresh
* Rewrite docs
* Support blocks in addition to method names and Proc args
* Check for valid arguments
* Convert `periodically :method_name` to Proc callbacks
* Drop periodic runner methods from the worker pool
* Ensure we clear active periodic timers after shutdown
2016-04-18 13:08:22 -07:00
Vipul A M
7165714637 Merge pull request #24600 from tomkadwill/action-cabel-channel-typos
Fix typos in ActionCable Channel [ci skip]
2016-04-18 19:20:27 +05:30
Tom Kadwill
2ef18c1ebc Fix typos in ActionCable Channel [ci skip] 2016-04-18 08:43:50 +01:00
yuuji.yaginuma
aa757d0c11 don't remove cable.js
`cable.js` is required for other Channels.
2016-04-16 15:19:41 +09:00
Jeremy Daer
92182d0d5b Merge pull request #24559 from vipulnsward/fix-ac-tests
Fixed ActionCable::Connection::ClientSocketTest test
2016-04-15 09:51:09 -07:00
Vipul A M
02a31cfdd1 - Fixed ActionCable::Connection::ClientSocketTest that was overriding ActionCable::Connection::StreamTest test name
- Only add attr_readers for required attributes
2016-04-15 16:03:21 +05:30
Vipul A M
8ad9670abb Merge pull request #24557 from y-yagi/update_example_to_specify_ac_mount_path
update example to specify the Action Cable mount path [ci skip]
2016-04-15 16:00:42 +05:30
yuuji.yaginuma
a2f034335d update example to specify the Action Cable mount path [ci skip]
Follow up to 8b69f1e
2016-04-15 19:16:01 +09:00
Sean Griffin
d1766ef53d Run Action Cable callbacks through the worker pool
Alternate implementation of #24162 with tests. The code had diverged
too far on master to pull that implemenation directly.

Fixes #23778
Close #24162

[Mattew Draper & Sean Griffin]
2016-04-13 13:09:16 -06:00
Prathamesh Sonpatki
d0023deb74
Generate cable.js file if does not exist when generating channel
- Before this, while generating a channel, we were not creating
  `cable.js` if it does not already exist.
- We have similar code for application mailer here -
  0b3ae023d2.
- Based on the comment -
  https://github.com/rails/rails/issues/24418#issuecomment-205421995.
2016-04-12 22:49:38 +05:30
Jeremy Daer
9c2945f4cc Cable typo: isSupportedProtocol -> isProtocolSupported 2016-04-05 21:56:59 -07:00
Jeremy Daer
fa3537506a Merge pull request #24224 from danielrhodes/actioncable-websocket-protocols
ActionCable protocol negotiation
2016-04-05 09:26:11 -07:00
Daniel Rhodes
cbd15da027 Added protocol negotiation
This is primarily for backwards compatibility for when
or if the protocol is changed in future versions.

If the server fails to respond with an acceptable
protocol, the client disconnects and disables
the monitor.
2016-04-05 15:55:59 +02:00
Jeremy Daer
b168eb5819 Cable message encoding
* Introduce a connection coder responsible for encoding Cable messages
  as WebSocket messages, defaulting to `ActiveSupport::JSON` and duck-
  typing to any object responding to `#encode` and `#decode`.
* Consolidate encoding responsibility to the connection. No longer
  explicitly JSON-encode from channels or other sources. Pass Cable
  messages as Hashes to `#transmit` and rely on it to encode.
* Introduce stream encoders responsible for decoding pubsub messages.
  Preserve the currently raw encoding, but make it easy to use JSON.
  Same duck type as the connection encoder.
* Revert recent data normalization/quoting (#23649) which treated
  `identifier` and `data` values as nested JSON objects rather than as
  opaque JSON-encoded strings. That dealt us an awkward hand where we'd
  decode JSON strings… or not, but always encode as JSON. Embedding
  JSON object values directly is preferably, no extra JSON encoding,
  but that should be a purposeful protocol version change rather than
  ambiguously, inadvertently supporting multiple message formats.
2016-03-31 07:08:16 -07:00
Jeremy Daer
4c79c59c6e Cable: reconcile default worker pool size with low db conn pool size
Whack it down from 100 to 4.

Large worker pools means large db connection counts. We aren't set up
for that by default and most apps won't need it out of the box.

We're better off tuning the default worker pool for low traffic, low
resource consumption apps. Those who have higher traffic will scale up
to meet demand.
2016-03-30 16:07:19 -07:00
Rafael Mendonça França
0df82a6453 Fix CHANGELOG entry [ci skip] 2016-03-30 00:34:37 -03:00
Rafael Mendonça França
edbfd10876 Keep logging in the ActionCable::Channel::Base
To move Action Cable logging to a LoggingSubscriber we need to pass the
log tags in the notification payload since Action Cable logging use the
Channel instance to tag the logs.
2016-03-30 00:03:11 -03:00
Rafael Mendonça França
6786718766 Merge pull request #23723 from mwear/action_cable_notifications
Add ActiveSupport::Notification to Channel::Base#perform_action
2016-03-29 23:42:21 -03:00
Kasper Timm Hansen
dacfdf03d3 Cable: Shush pop warnings when skipping Postgres tests.
`skip` raises an exception to abort the execution of the test, so
`super` would never be called and thus `@rx_adapter` and `@tx_adapter`
would never have been defined at the time of teardown.

Define them just before skipping and zap the warnings.
2016-03-26 21:49:18 +01:00
Kasper Timm Hansen
f6b4bf6593 Shush up EM::Hiredis when running tests.
EM::Hiredis were spewing screenfuls of warnings when running the Action Cable tests.

Copied over the technique that shushes up faye-websocket in the client tests, so
we can reduce the noise ratio.

Note: there's still warnings spewed after tests have finished when EM::Hiredis shuts
down. I haven't been able to shush them up yet.
2016-03-26 21:05:02 +01:00
Jeremy Daer
5dc4bf8291 Cable: fix Faye periodic timer shutdown typo 2016-03-24 10:29:11 -07:00
Jeremy Daer
09e30d9ada Merge pull request #24259 from jeremy/cable/disconnected-client-errors
Cable: Gracefully handle disconnected clients
2016-03-23 13:24:44 -07:00
Jon Evans
ff5f1d33fc Fix WebSocket already open log message typo 2016-03-22 12:55:37 -06:00
Jeremy Daer
4f8a8e2c06 Gracefully handle disconnected clients
We'll get `Errno::ECONNRESET` if the client forcibly disconnected.
Just close the socket rather than raising the exception.

Handle other errors in `ClientSocket#write`, too, mirroring the Faye
error handling which swallows all `StandardError` on write.
2016-03-20 17:36:22 -07:00
Jeremy Daer
8076d7e191 Cable: add isolated tests and FAYE=1 test runs 2016-03-20 17:00:46 -07:00
Jeremy Daer
265b7572c9 Evented Redis adapter: log reconnect failures as errors, not just info
[ci skip]
2016-03-17 21:23:36 -07:00
Jeremy Daer
d448918027 AC: skip PG adapter tests if the db isn't available 2016-03-11 16:32:19 -07:00
Gadzhi Gadzhiev
37606d016d Remove redundant regexp escapes in generators 2016-03-08 15:30:12 +03:00
Matthew Wear
09a1321d5b Add AS::Notifications and LogSubscriber to ActionCable::Channel
This commit adds ActiveSupport::Notifications instrumentation hooks
and a LogSuscriber to ActionCable::Channel::Base.
2016-03-04 14:47:54 -08:00
Javan Makhmali
1d5f80c758 Return subscription object(s) when updating the collection 2016-03-04 10:34:24 -05:00
Pratik Naik
9ce6fe439a Make sure ActionCable.Subscriptions#create always returns the newly created subscription object 2016-03-04 09:30:15 -06:00
Javan Makhmali
3e4ecbe8e6 Store reference to Subscriptions instance for convenience 2016-03-03 21:44:11 -05:00
Javan Makhmali
f1c93ed828 Implicity add Subscription instance to subscriptions collection 2016-03-03 21:40:16 -05:00
Javan Makhmali
6689d7c7b9 Share default mount path with client side .js 2016-03-03 21:27:52 -05:00
Javan Makhmali
5e84b95578 Fix location of default mount path value
#getConfig was implmented as general utility for reading action-cable-* meta tags (hence the `name` argument). Introduced in 8b69f1eeba753c38364fb88136b2503480f2de1d.
2016-03-03 21:10:10 -05:00
Javan Makhmali
96e6de9552 Defer starting connection monitor until a connection is opened 2016-03-03 20:23:20 -05:00
Javan Makhmali
82a1bf268d Establish WebSocket connection when first subscription is created. Fixes #24026
* More intention revealing than connecting on the first call to Connection#send
* Fixes that calls to Connection#send would attempt to open a connection when the WebSocket's state is CONNECTING
2016-03-03 17:59:12 -05:00
Matthew Draper
bbba0649f5 Merge pull request #23992 from matthewd/em-option
Support faye-websocket + EventMachine as an option
2016-03-04 05:31:48 +10:30
Daniel Rhodes
78b0ac3259 ConnectionMonitor is once again notified of disconnect 2016-03-03 15:00:11 +01:00
Jeremy Daer
4f21ac7e9c Fix CHANGELOG spacing [ci skip] 2016-03-02 11:37:19 -07:00
Jon Moss
45635098ac Accept JSON with no backslashes/escaping
Fixes #22675

Allow channel identifiers and also data with no backslahes/escaping to be accepted by
the subscription storer.
2016-03-02 09:01:43 -05:00
Matthew Draper
fc1b32f8d1 Merge pull request #23976 from danielrhodes/enhancement/ac-ping-to-message-type
ActionCable: Add a "welcome" and "ping" message type
2016-03-02 19:17:57 +10:30
Matthew Draper
a373be9da4 Support faye-websocket + EventMachine as an option 2016-03-02 12:17:15 +10:30
Arthur Nogueira Neves
15c308582f Merge pull request #23932 from arthurnn/arthurnn/remove_load_paths
Remove load_paths file
2016-03-01 16:10:09 -05:00
Rafael França
998d21a961 Merge pull request #23935 from y-yagi/convert_cable_coffee_to_javascript
convert cable.coffee to cable.js
2016-03-01 15:19:52 -03:00
Matthew Draper
185c93eb0c Use AS::Executor / AS::Reloader to support reloading in ActionCable 2016-03-02 02:14:20 +10:30
Daniel Rhodes
53e163dc3f Make ping into a message type
This change makes ping into a message type, which
makes the whole protocol a lot more consistent.

Also fixes hacks on the client side to make this all
work.
2016-03-01 02:48:15 +01:00
Bouke van der Bijl
242abf8850 Remove inconsistency in the Action Cable README [ci skip] 2016-02-29 20:25:30 -05:00
Daniel Rhodes
f51cb7eef5 Added welcome message type and fix test hacks 2016-03-01 01:38:35 +01:00
David Heinemeier Hansson
dabf47938f Merge pull request #23811 from iamvery/string-channel
Ensure actioncable behaves as expected with non-string queues
2016-02-28 14:58:28 +01:00
yuuji.yaginuma
861e7d43e3 convert cable.coffee to cable.js
In order to eliminate the dependecy of CoffeeScript.
2016-02-28 15:07:03 +09:00
Hayley Anderson
b425a86591 Add small Action Cable documentation fixes
* Fix typos/grammar errors
* Make capitalization/naming consistent
2016-02-27 13:53:31 -05:00
Arthur Neves
2abcdfd978 Remove load_paths file 2016-02-27 13:03:57 -05:00
Jeremy Daer
e0a225a3d5 Merge pull request #23916 from lifo/same-redis-connection-for-subscription-and-broadcast
Always use redis_connector to create redis connections
2016-02-26 11:45:17 -07:00
Pratik Naik
4056a9e815 Use redis_connector to create redis connections for both subscriptions and broadcasts 2016-02-26 12:31:14 -06:00
Matthew Draper
f1a76bd429 The async.callback call should live with the hijack
If we're deferring one, we should defer the other too.
2016-02-26 13:58:54 +10:30
Matthew Draper
50e4433b05 Merge pull request #23843 from maclover7/fix-23471
Only hijack Rack socket when first needed
2016-02-25 13:58:31 +10:30
Jon Moss
a536cc8f1e Only hijack Rack socket when first needed
Fixes #23471
2016-02-24 21:48:59 -05:00
Jon Moss
1afd414488 Only open Action Cable connection if data is being sent 2016-02-24 20:37:52 -05:00
Jon Moss
8b69f1eeba Enable Action Cable routes by default
This also marks Action Cable routes as internal to Rails.
2016-02-24 19:05:03 -05:00
Jay Hayes
bbe59375d0 Update changelog 2016-02-24 17:22:26 -06:00
Jay Hayes
3ecab07800 Ensure server broadcasts are to string queue names
Similar to the channel streaming side, these values must be strings for
ActionCable to behave as expected. The conversion will allow users to
send string-convertible values and get the expected behavior.
2016-02-24 17:22:06 -06:00
Jay Hayes
046e32656e Convert stream broadcasting to a string
ActionCable does some things behind the scenes that expects these
"broadcasting"s or "channel"s to be strings. However it's not
immediately obvious that the value must be a string. So adding this
conversion ensures things work as expected.
2016-02-24 12:43:23 -06:00
Jay Hayes
b426247250 whitespace 2016-02-24 12:42:55 -06:00
claudiob
7d46371d89 Add Ruby formatting to CHANGELOG entry
[ci skip]
2016-02-24 08:49:33 -08:00
eileencodes
dbfa8fdfc2 Preparing for 5.0.0.beta3 release
Adds changelog headers for beta3 release
2016-02-24 11:14:40 -05:00
eileencodes
826420b5fc Prep release for Rails 5 beta3 2016-02-24 10:27:02 -05:00
Rafael França
3adc35aefa Merge pull request #23789 from wisetara/wisetara/deprecate-args-ActiveSupport__TestCase#assert_nothing_raised-for-pr
Wisetara/deprecate args active support  test case#assert nothing raised for pr
2016-02-23 13:59:49 -03:00
David Heinemeier Hansson
b2c2d32908 Merge pull request #23813 from lifo/faye-websocket
Improve Action Cable reconnection reliability
2016-02-23 16:41:26 +01:00
Javan Makhmali
c889408e0d Fix isAlive condition and add more logging 2016-02-23 09:37:50 -06:00
Javan Makhmali
dde833816a ActionCable.log 2016-02-23 09:37:50 -06:00
Javan Makhmali
1a90ff9a4d Uninstall event handlers when replacing WebSocket instance
Ensures we don't get "onclose" events from a previous WebSocket that was in the "closing" state
2016-02-23 09:37:49 -06:00
Javan Makhmali
ab28276713 Connection#isAlive 2016-02-23 09:37:49 -06:00
Pratik Naik
96118db335 Log ConnectionMonitor connect 2016-02-23 09:37:49 -06:00
Pratik Naik
426676e8d0 Confirm connection monitor subscription on open 2016-02-23 09:37:49 -06:00
Pratik Naik
725c913c90 Treat 'closing' state as closed.
We are seeing cases where the websockets get stuck in the 'closing' state
after a tab has been in background for a while. So lets treat those websockets
as closed.
2016-02-23 09:37:49 -06:00
Javan Makhmali
832f88bdf3 Add client-side console logging to help debug reconnect issues 2016-02-23 09:37:49 -06:00
Tara Scherner de la Fuente
926a24a751 remove args from assert_nothing_raised in tests 2016-02-22 22:56:23 -08:00
Mehmet Emin İNAÇ
e8f4954086 Action Cable readme fix [ci skip] 2016-02-23 04:16:22 +02:00
Rafael França
d3f0aa36c3 Merge pull request #23668 from maclover7/cable-docs
Full Action Cable documentation read through
2016-02-22 22:55:39 -03:00
Jon Moss
cf423f8f76 Add notes for future selves
Once RubyGems 2.5.0 is required, then the duplicated files can be
removed, and symlinks can be used instead.

[ci skip]
2016-02-22 20:46:11 -05:00
Jon Moss
83921b8f87 Generate ApplicationCable files if they do not already exist 2016-02-22 20:46:06 -05:00
Chashmeet Singh
3f97d77372 Fixed typo 2016-02-21 14:09:42 +05:30
David Heinemeier Hansson
2a83a6e878 Merge pull request #23709 from jankeesvw/set-action-cable-logging-to-debug
Make ActionCable logging less verbose in development
2016-02-19 16:04:24 +01:00
Matthew Draper
6da571add8 Merge pull request #23715 from maclover7/fix-unsubscribe
Fix `unsubscribed` server side behavior
2016-02-19 11:17:51 +10:30
Jon Moss
cefcc0f66e Fix unsubscribed server side behavior
Before this commit, the `unsubscribed` callbacks in Action Cable server
side channels were never called. This is because when a WebSocket
"goodbye" message was sent from the client, the Action Cable server
didn't properly clean up after the now closed WebSocket. This means that
memory could possibly skyrocket with this behavior, since part of this
commit is to properly remove closed subscriptions from the global
subscriptions hash. Say you have 10,000 users currently connected, and
then all 10,000 disconnect -- before this patch, Action Cable would
still hold onto information (and Ruby objects!) for all of these now
dead connections.
2016-02-18 16:26:17 -05:00
Matthew Draper
604fd2cb22 Use a semaphore to signal message availability
The Event hack was too much of a hack: on actually thinking about it,
there's a rather obvious race.
2016-02-19 07:50:42 +10:30
Jankees van Woezik
3fe383c601 Truncate ActionCable broadcast message to 300 chars
When running the ActionCable server in development I get a lot of output
in my logs, this commit sets a maximum length of 300 characters for a
broadcast log message.
2016-02-18 15:42:57 +01:00
Jon Moss
05088b6299 Full Action Cable documentation read through
This PR checks all active Action Cable documentation for typos and other
fixes. It aims to make sure that when Rails 5 is released, that the
Action Cable docs are up to snuff with the other documentation included
with Rails.

[ci skip]
2016-02-17 11:08:00 -05:00
Kasper Timm Hansen
3c96a6eaa4 Merge pull request #23505 from kaspth/inject-rails-config-through-railtie
Inject Rails related configuration through Railtie
2016-02-14 18:08:46 +01:00
Kasper Timm Hansen
3ae8eb13cb Don't rely on the global server as a receiver.
The `WorkerTest`'s `Receiver` is imporsonating an `ActionCable::Connection::Base`, but
just delegates the logger to `ActionCable.logger`.

This creates a mismatch as the connection requires the logger to be a
`TaggedLoggerProxy`'ied logger, while the server doesn't.

Thus to ensure an exception isn't raised when the worker tries to call `tag`
other tests have to assign a proxied logger to their test server.

Instead of forcing change on other tests, have Receiver adhere to the connection
contract and use a `TaggedLoggerProxy`.

As a consequence remove more setup from the tests.
2016-02-14 17:46:48 +01:00
Kasper Timm Hansen
861ece99bb Default connection class to ActionCable::Connection::Base.
Instead of depending on ApplicationCable::Connection being defined at initialize
we should inject it in the Railtie.

Thus we can kill more setup in the tests too.
2016-02-14 17:46:48 +01:00
Kasper Timm Hansen
661298176c Inject Rails' channel paths in engine.
We were explicitly referencing Rails.root in ActionCable::Server::Configuration.initialize,
thereby coupling ourselves to Rails.

Instead add `app/channels` to Rails' app paths and assign the existent files
to `channel_paths`.

Users can still append to those load paths with `<<` and `push` in `config/application.rb`.

This means we can remove the custom `Dir` lookup in `channel_paths` and the Rails
and root definitions in the tests.
2016-02-14 17:46:48 +01:00
Ryuta Kamizono
1335959135 Fix grammar a to an [ci skip] 2016-02-13 20:44:44 +09:00
Jon Moss
887d34c7f6 Merge pull request #23546 from maclover7/cable-readme-update
ActionCable README updates
2016-02-11 16:53:36 -05:00
kp
ec4ae308a7 Merge remote-tracking branch 'origin/master' into actioncable_logging 2016-02-10 17:44:54 +00:00
kp
8641de93eb Logs successful and invalid connections separately 2016-02-10 17:11:12 +00:00
Mawueli Kofi Adzoe
f2fcd3a000 Fix tiny grammar. 2016-02-09 22:35:40 -07:00
Ryuta Kamizono
3f184cab48 Fix typo [ci skip] 2016-02-09 09:47:47 +09:00
Jon Moss
1fddb0e622 ActionCable README updates
[ci skip]
2016-02-08 17:21:55 -05:00
प्रथमेश Sonpatki
e8580c63db Merge pull request #23556 from y-yagi/remove_faye-websocket_from_readme
remove `faye-websocket` dependency from README [ci skip]
2016-02-08 08:24:51 +05:30
yuuji.yaginuma
3546b3f0d4 remove faye-websocket dependency from README [ci skip]
`faye-websocket` gem is no longer used from 322dca293b3716ccaa09e7e82046e539b0d2ffda.
2016-02-08 11:47:03 +09:00
Daniel Fox
0ec48ab0cb config examples for ActionCable now use Rails.application.config.action_cable
Some existing examples used ActionCable.server.config but for
configuring allowed_request_origins that is overridden in development
mode. The correct place to set that is
Rails.application.config.action_cable which the ActionCable initializer
loads from. I thought the other two examples should be changed as well
just in case a default value that would override a configured value is
introduced for either log_tags or disable_request_forgery_protection in
the future.
2016-02-07 17:02:47 -06:00
David Heinemeier Hansson
7fe32d28a8 Cant run on an out-of-the-box OSX installation without running out of TOO MANY FILES OPEN 2016-02-05 15:23:34 +01:00
yuuji.yaginuma
cdb6f2eb9e don’t explicitly mention EventMachine [ci skip]
Follow up to 6accef4e11b0c793e1c085536b5ed27f32b6a0c3
2016-02-05 21:52:59 +09:00
David Heinemeier Hansson
5e5fd246d5 Allow for non-standard redis connectors 2016-02-04 12:10:35 +01:00
Hongli Lai (Phusion)
3366a3ad78
Document the fact that Action Cable does not require a multi-threaded app server
[ci skip]
2016-02-03 19:07:16 +01:00
Nick Quaranto
8305437385 [ci skip] Several ActionCable documentation updates:
* Properly indent code sample in ActionCable::Channel::Streams
* Add a doc comment for #stop_all_streams
* Reformat + add <tt> blocks around code references in ActionCable::Base docs
* Clarify and a little better grammar on ActionCable::RemoteConnections
* Correct indentation and clean up ActionCable::Server::Broadcasting code sample
2016-02-02 15:00:05 -05:00
Rafael Mendonça França
60b040e362 Add some Action Cable CHANGELOG entries
And improve changelongs.

[ci skip]
2016-02-01 19:57:50 -02:00
Sean Griffin
49f6ce63f3 Preparing for Rails 5.0.0.beta2 2016-02-01 14:37:52 -07:00
Matthew Draper
8a51f6fbbf Merge pull request #23381 from matthewd/uneventful-redis
Redis sans EventMachine
2016-02-02 02:44:06 +10:30
Matthew Draper
55e33667a6 Remove development dependencies from actioncable.gemspec
None of the other components use them, so we should be consistent.
2016-02-01 13:22:47 +10:30
Guillermo Iguaran
d6e0eeb1c6 Merge pull request #23370 from maclover7/actioncable-main-travis-build
Move Action Cable back to the main build
2016-01-31 16:56:03 -05:00
Jon Moss
ddd84f6193 Remove unused method 2016-01-31 16:14:26 -05:00
Matthew Draper
93abf58787 Drop the runtime dependency on coffee-rails 2016-02-01 05:14:02 +10:30
Matthew Draper
d6f2000a67 Wrangle the asset build into something that sounds more general 2016-02-01 05:03:03 +10:30
Matthew Draper
ca9603fc35 Merge pull request #23369 from maclover7/actioncable-assets-redux
Action Cable Assets Compilation redux
2016-02-01 05:02:48 +10:30
Matthew Draper
4c38319cc2 Wait for EventMachine to finish starting 2016-02-01 03:01:32 +10:30
Matthew Draper
e77368637e Switch the default redis adapter to a single-stream model
This new adapter does get a little more intimate with the redis-rb gem's
implementation than I would like, but it's the least bad of the
approaches I've come up with.
2016-02-01 01:56:47 +10:30
Jon Moss
09a7060659 Improvements and reorganization of assets 2016-01-30 20:44:42 -05:00
Javan Makhmali
896950a605 Add task to create precompiled action_cable.js and reorganize to accommodate 2016-01-30 20:41:54 -05:00
Matthew Draper
0ae187961c Use a gentler disconnect
The detach used by close! seems to be making EM very sad on Travis.
2016-01-30 07:51:41 +10:30
Matthew Draper
e6d0d4b1ae Don't bother stopping EM between tests
It's not strictly necessary, and maybe this will help with the current
test failure.
2016-01-30 06:41:14 +10:30
Kesha Antonov
1c893bc2f9 remove require logging 2016-01-29 21:56:51 +03:00
Matthew Draper
4d01cd1545 Keep the socket reference after close
We may still try to send to it.
2016-01-30 03:46:37 +10:30
Matthew Draper
3043601d7a Reduce the client count, in hope of a more consistent test 2016-01-30 03:46:37 +10:30
Matthew Draper
0b94afb075 Be more patient while gathering the expected responses 2016-01-30 03:46:37 +10:30
Matthew Draper
786ed1b3ad Handle more IO errors (especially, ECONNRESET)
Also, address the possibility of the listen thread dying and needing to
be respawned. As a bonus, we now defer construction of the thread until
we are first given something to monitor.
2016-01-30 03:46:37 +10:30
Matthew Draper
ce37de4a19 Add a couple of tests that connect with a WS client 2016-01-30 03:46:37 +10:30
Matthew Draper
16a6603956 Synchronize the lazy setters in Server
They're all at risk of races on the first requests.
2016-01-30 03:46:37 +10:30
Matthew Draper
a928aa3d3f Fix arguments to on_close 2016-01-30 03:46:37 +10:30
Matthew Draper
74497eabd5 Revert "Revert "Eliminate the EventMachine dependency"" 2016-01-30 03:46:37 +10:30
David Heinemeier Hansson
9ea7aa84d1 Revert "Eliminate the EventMachine dependency" 2016-01-27 14:33:15 +01:00
kp
ae9c08f392 adds debug logging to actioncable connect 2016-01-26 23:19:49 +00:00
claudiob
6accef4e11 [ci skip] Don’t explicitly mention EventMachine
Since #23152 eliminated the EventMachine dependency, we don’t need to
explicitly mention EventMachine.

Nevertheless, I'm not 100% sure about saying "the websocket-driver loop"
driver… any suggestions, @matthewd or @pixeltrix ? 😅

[ci skip]
2016-01-25 18:49:40 -08:00
Aaron Patterson
6dfab475ca Merge branch '5-0-beta-sec'
* 5-0-beta-sec:
  bumping version
  fix version update task to deal with .beta1.1
  Eliminate instance level writers for class accessors
  allow :file to be outside rails root, but anything else must be inside the rails view directory
  Don't short-circuit reject_if proc
  stop caching mime types globally
  use secure string comparisons for basic auth username / password
2016-01-25 11:25:11 -08:00
Aaron Patterson
908c011395 bumping version 2016-01-25 10:22:15 -08:00
Kasper Timm Hansen
323ec89aab Merge pull request #23185 from droptheplot/actioncable-custom-channels
ActionCable: Allow adding custom paths for channels
2016-01-24 18:14:59 +01:00
Matthew Draper
503fe757c7 Ditch the EM error logging helper
We're no longer doing our work in the EM event loop, so errors are quite
unlikely, and if they do occur, they're not really our responsibility to
handle.
2016-01-24 22:54:04 +10:30
Matthew Draper
322dca293b Import the relevant portions of faye-websocket
(as adapted to use concurrent-ruby / nio4r instead of eventmachine)
2016-01-24 22:52:40 +10:30
Matthew Draper
68a9060d02 Using a hacked faye-websocket, drop EventMachine 2016-01-24 22:51:06 +10:30
Matthew Draper
9ff28c10eb Add tests for the ActionCable adapters 2016-01-24 21:13:40 +10:30
Matthew Draper
7363ad43f5 Allow subscription adapters to be shut down 2016-01-24 19:00:06 +10:30
Matthew Draper
b17a7e4c4d Add Async and Inline adapters
Just like their ActiveJob equivalents, these only work within the
current process.
2016-01-24 15:52:47 +10:30
Matthew Draper
e81bb80cb4 Normalize on no arguments for the success callback 2016-01-24 15:52:47 +10:30
Matthew Draper
dccc15d403 Split internal subscriber tracking from Postgres adapter 2016-01-24 15:52:47 +10:30
yuuji.yaginuma
57a1abafdb fix path of Action Cable configuration file [ci skip]
This changed in #22950.
2016-01-23 15:01:32 +09:00
Sergey Novikov
a17f7a0bc1 Rename channels_path var and fix channel_paths method for ActionCable config 2016-01-23 02:50:03 +03:00
Derek Kniffin
08ac76d1ad Move ApplicationCable::Channel section of readme
I believe the paragraph starting with "This relies" belongs with the one above it.
2016-01-22 14:01:44 -05:00
Brit Gardner
2bc0c7ca02 Use the correct reference to the redis connection
Fixes #23193

This was throwing `There was an exception - NameError(undefined local variable or method `hi_redis_conn' for #<ActionCable::SubscriptionAdapter::Redis:0x007fb1449e2b70>)` on unsubscribe.
2016-01-22 10:59:44 -06:00
Sergey Novikov
91656aed59 Allow adding custom paths for action_cable channels 2016-01-22 16:52:12 +03:00
Jon Moss
17a631f427 Small doc update per RF [ci skip] 2016-01-20 17:13:43 -05:00
Jon Moss
1600c67ff9 Add CHANGELOG.md entry for #22950
[ci skip]
2016-01-20 17:05:47 -05:00
Matthew Draper
56a9341689 Merge pull request #22950 from maclover7/adapterize-storage-actioncable
Adapterize storage for ActionCable
2016-01-20 16:09:20 +10:30
Jon Moss
ae31da20cd Fix code review comments
- adapter -> pubsub (re)rename internally
- Change variable names to match method names
- Add EventMachine `~> 1.0` as a runtime dependency of ActionCable
- Refactor dependency loading for adapters
2016-01-18 19:37:25 -05:00
Jon Moss
67af248d51 Small PostgreSQL adapter refactors / cleanup
- Escape the channel name when subscribing in PG
- Refactor popping the queue to make it easier to read
2016-01-18 18:59:31 -05:00
Jon Moss
4c5d5b75ab ActionCable::StorageAdapter ==> ActionCable::SubscriptionAdapter 2016-01-18 18:59:30 -05:00
Jon Moss
6aeaed4c1a All Redis deps are now optional, Postgres --> PostgreSQL adapter 2016-01-18 18:59:30 -05:00
Jon Moss
75489642c8 config_opts => cable, per @kaspth 2016-01-18 18:59:28 -05:00
Matthew Draper
78ff63ee41 Listener no longer needs to be a singleton
We now only create one adapter instance for the server, so it can hold
the listener. This in turn allows the listener to get the PG connection
from the adapter, which will be a good place to allow more flexible
configuration.
2016-01-18 18:59:01 -05:00
Jon Moss
bc413e814b Tests passing and small refactoring 2016-01-18 18:59:01 -05:00
Matthew Draper
9631c67710 Blanket unsubscribe doesn't appear to be used 2016-01-18 18:59:01 -05:00
Matthew Draper
05d753ff31 Don't execute callbacks on our main listener thread 2016-01-18 18:59:01 -05:00
Matthew Draper
2815db3569 Pull the action methods directly onto the adapter 2016-01-18 18:59:00 -05:00
Jon Moss
7b79ae0335 Add Postgres adapter 2016-01-18 18:59:00 -05:00
Jon Moss
439154250c Refactor storage_adapter 2016-01-18 18:59:00 -05:00
Jon Moss
0016e0410b Adapterize ActionCable storage and extract behavior 2016-01-18 18:58:57 -05:00
Jon Moss
d95d680d68 Merge pull request #23096 from HayleyCAnderson/ha-action-cable-docs
[ci skip] Improve Action Cable configuration explanations
2016-01-18 09:30:42 -05:00
Hayley Anderson
04d4928e60 Improve Action Cable configuration explanations
* Clarify wording around how defaults work
* Clarify wording around what formatting versus information is required
* Separate consumer configuration section since it is important and wordy
* Add additional explanation of options for setting consumer configuration
* Consolidate consumer configuration information to reduce confusion
2016-01-18 00:22:00 -05:00
David Heinemeier Hansson
39f383bad0 Fix the updated API (this sorts the concurrent-ruby switch with Basecamp) 2016-01-16 15:50:25 +01:00
David Heinemeier Hansson
01c320001b Revert "Merge pull request #22977 from rails/revert-22934-master"
This reverts commit d0393fccffc118a5de37654aa222774b66123393, reversing
changes made to 3b7ccadfc1c8dfec61af898167e1300b17f5cf25.
2016-01-16 15:42:20 +01:00
DAVID MOORE
e4af3ad335 [ci skip] Fix typo in docs
Found this small omission while reviewing the ActionCable docs.
[Dave Moore]
2016-01-15 12:41:18 -05:00
David Heinemeier Hansson
36fe301564 Revert "Move async execution from celluloid to concurrent-ruby" 2016-01-08 20:09:25 +01:00
Mike Perham
cd1d7e287b don't need explicit dep and a pretty neat pick 2016-01-05 16:26:53 -08:00
Mike Perham
e529e3428e Use Module#thread_mattr_accessor 2016-01-05 15:11:10 -08:00
Mike Perham
2bb65e64e6 Remove celluloid references 2016-01-05 15:10:11 -08:00
Mike Perham
547713b4c9 Move async execution from celluloid to concurrent-ruby
This removes 8 runtime gem dependencies from Rails:

```
Using hitimes 1.2.3
Using timers 4.1.1
Using celluloid-essentials 0.20.5
Using celluloid-extras 0.20.5
Using celluloid-fsm 0.20.5
Using celluloid-pool 0.20.5
Using celluloid-supervision 0.20.5
Using celluloid 0.17.2
```
2016-01-05 14:31:16 -08:00
Rashmi Yadav
1b608a695c Update copyright notices to 2016 [ci skip] 2015-12-31 18:27:19 +02:00
Javan Makhmali
ce734eb093 Remove client-side Action Cable debugging code
Added to aid in developing Action Cable, but isn't neccessary for production operation.
2015-12-31 10:08:00 -05:00
Jan Habermann
eeb9fda8e2 [ActionCable] remove not needed protected call and newlines 2015-12-25 14:08:50 +01:00
Kasper Timm Hansen
a381add01f [ci skip] Steal ActionCable.server mounting from routes template.
Mounting it as prescribed here:

0d1d50c2db/railties/lib/rails/generators/rails/app/templates/config/routes.rb (L5)
2015-12-22 11:11:47 +01:00
Rafael Mendonça França
f51a30c666 Use the generators options to not generate channel assets 2015-12-21 18:58:08 -02:00
Robert Eshleman
a61b9be813 Update "Support" in ActionCable README [ci skip]
* Add link to API documentation
* Link to issue tracker for rails/rails (instead of rails/actioncable)
* Add link to rails-core mailing list for feature requests
2015-12-21 14:31:32 -05:00
David Heinemeier Hansson
97eb5553f9 Merge pull request #22717 from nning/actioncable-readme-fixes
ActionCable README.md fixes
2015-12-21 14:32:44 +01:00
David Heinemeier Hansson
26a8320c72 Merge pull request #22692 from ryohashimoto/22669_api_generator
Action Cable channel generator doesn't create JS assets if options[:rails][:assets] is false
2015-12-21 14:31:42 +01:00