Commit Graph

274 Commits

Author SHA1 Message Date
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
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
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