Commit Graph

127 Commits

Author SHA1 Message Date
Jon Moss
c420bedda7 Pass over Action Cable docs
[ci skip]
2016-05-21 11:55:04 -04: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
Vijay Dev
83ecf3fe56 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/configuring.md
2016-05-14 09:54:23 +00:00
Rafael Mendonça França
8ecc5ab1d8 Start Rails 5.1 development 🎉 2016-05-10 03:46:56 -03: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
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
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
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
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
Jeremy Daer
5dc4bf8291 Cable: fix Faye periodic timer shutdown typo 2016-03-24 10:29:11 -07: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
265b7572c9 Evented Redis adapter: log reconnect failures as errors, not just info
[ci skip]
2016-03-17 21:23:36 -07: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
6689d7c7b9 Share default mount path with client side .js 2016-03-03 21:27:52 -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
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
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
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
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
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
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
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
eileencodes
826420b5fc Prep release for Rails 5 beta3 2016-02-24 10:27:02 -05: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
Pratik Naik
426676e8d0 Confirm connection monitor subscription on open 2016-02-23 09:37:49 -06: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
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