Commit Graph

260 Commits

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