Commit Graph

306 Commits

Author SHA1 Message Date
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
Genadi Samokovarov
c5b6ec7b0f No more no changes entries in the CHANGELOGs
During the `5.0.0.beta1` release, the CHANGELOGs got an entry like the
following:

```
* No changes.
```

It is kinda confusing as there are indeed changes after it. Not a
biggie, just a small pass over the CHANGELOGs.

[ci skip]
2015-12-21 11:46:38 +02:00
henning mueller
9f00021268 One long dash in headline. 2015-12-21 10:05:32 +01:00
henning mueller
cb6f337aac Use default cable path in (in-app) server config example. 2015-12-21 09:44:02 +01:00
henning mueller
16bee0f5bd Replaced "Cable" by "ActionCable" in CoffeeScript examples. 2015-12-21 09:35:37 +01:00
Yves Senn
8615f8b5c8 docs, follow up to #22699. [ci skip] 2015-12-19 14:42:09 +01:00
Oleg Motenko
059aae74d1 Update README.md 2015-12-19 15:06:56 +02:00
Ryo Hashimoto
61366f5a3d Action Cable channel generator should not create JS assets in --api mode 2015-12-19 13:43:11 +09:00
Akshay Vishnoi
0e5b6d5958 [ActionCable] declare asset_logged private 2015-12-19 04:14:58 +05:30
eileencodes
099ddfdefd Add CHANGELOG headers for Rails 5.0.0.beta1 2015-12-18 15:58:25 -05:00
eileencodes
7eae0bb88e Change alpha to beta1 to prep for release of Rails 5
🎉 🍻
2015-12-18 12:14:09 -05:00
Kasper Timm Hansen
1c47f7d184 Merge pull request #22668 from ryohashimoto/151219_receive
Fix `receive` spelling
2015-12-18 17:28:31 +01:00
Ryo Hashimoto
161dc68599 Fix receive spelling 2015-12-19 01:09:16 +09:00
Rafael França
905a2a176b Merge pull request #22667 from akshay-vishnoi/base_test_case
[ActionCable] Test invalid action on channel
2015-12-18 14:07:55 -02:00
Kasper Timm Hansen
6a2c3c4c83 Fix receive spelling and add whitespace
Found `recieve` next to the correctly spelled method name, fixed it.

Also we prefer a one space padding within hashes, add that.
2015-12-18 16:53:04 +01:00
Akshay Vishnoi
46adddbfb5 [ActionCable] Test invalid action on channel 2015-12-18 21:10:06 +05:30
Akshay Vishnoi
fef41f40b6 [ActionCable] test perform action with default action 2015-12-18 20:45:43 +05:30
Rafael França
90101afe1a Merge pull request #22660 from y-yagi/add_line_break_between_methods
add line break between method of generated channel js
2015-12-18 12:42:50 -02:00
Akshay Vishnoi
db36507644 [ActionCable] Test available actions on Channel 2015-12-18 20:02:45 +05:30
David Heinemeier Hansson
83e3a17d32 Same gemspec formats everywhere 2015-12-18 13:20:49 +01:00
David Heinemeier Hansson
eb5ca8e16d Stray line 2015-12-18 13:16:01 +01:00
David Heinemeier Hansson
ed33d1d641 Simplify 2015-12-18 13:15:56 +01:00
David Heinemeier Hansson
21efa5218b Now available in action_cable 2015-12-18 13:15:52 +01:00
yuuji.yaginuma
4a7bd88eaf add line break between method of generated channel js
```
# before
App.appearance = App.cable.subscriptions.create "AppearanceChannel",
  connected: ->
    # Called when the subscription is ready for use on the server

  disconnected: ->
    # Called when the subscription has been terminated by the server

  received: (data) ->
    # Called when there's incoming data on the websocket for this channel

  appear: ->
    @perform 'appear'
  away: ->
    @perform 'away'
```

```
# after
App.appearance = App.cable.subscriptions.create "AppearanceChannel",
  connected: ->
    # Called when the subscription is ready for use on the server

  disconnected: ->
    # Called when the subscription has been terminated by the server

  received: (data) ->
    # Called when there's incoming data on the websocket for this channel

  appear: ->
    @perform 'appear'

  away: ->
    @perform 'away'
```
2015-12-18 20:19:04 +09:00
Akshay Vishnoi
ebad5c72d3 [ci skip] Fix grammar 2015-12-18 16:30:18 +05:30
Akshay Vishnoi
2728377d0f [ci skip] Fix typo 2015-12-18 12:12:52 +05:30
Guillermo Iguaran
80e00ac84a Merge pull request #22639 from arunagw/aa-remove-few-warnings-actioncable
Remove warnings from actioncable test
2015-12-17 17:47:39 -05:00
David Heinemeier Hansson
e16d7c6808 Should also stub the received callback 2015-12-17 21:53:05 +01:00
eileencodes
19e7f65dd1 Don't log Action Cable to STDOUT in development
Logging Action Cable to STDOUT caused the development log to see double
messages like this:

```
Started GET "/" for ::1 at 2015-12-17 15:21:34 -0500
Started GET "/" for ::1 at 2015-12-17 15:21:34 -0500
Processing by Rails::WelcomeController#index as HTML
Processing by Rails::WelcomeController#index as HTML
Rendered /welcome/index.html.erb (0.0ms)
Rendered /welcome/index.html.erb (0.0ms)
Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
Completed 200 OK in 3ms (Views: 1.3ms | ActiveRecord: 0.0ms)
```

Now that Action Cable is part of Rails it doesn't need it's own logger
and will log to STDOUT via the local dev server here:
https://github.com/rails/rails/blob/master/railties/lib/rails/commands/server.rb
2015-12-17 15:30:40 -05:00
Gaurav Sharma
c9b750f951 traditional make sense with <tt>ActiveSupport::TaggedLogging</tt> 2015-12-18 00:30:36 +05:30
Arun Agrawal
e1459c7c86 Remove warnings from actioncable
Warnings coming from code and test are removed
2015-12-17 16:42:34 +01:00
Paul Montero
96a63787bc Update USAGE
Fix typo
2015-12-17 10:17:52 -05:00
Xavier Noria
7daad3a401 Update README.md
ActiveRecord -> Active Record [ci skip]
2015-12-17 15:00:19 +01:00
David Heinemeier Hansson
3a83097ee6 Quiet warnings 2015-12-16 22:02:30 +01:00
David Heinemeier Hansson
a22074749a Clarify 2015-12-16 21:05:19 +01:00
David Heinemeier Hansson
28035db109 Generate all the ApplicationCable stubs by default, like all other Application* stubs 2015-12-16 21:05:13 +01:00
David Heinemeier Hansson
bf16ec25b3 Comment out the user handling so default setup connects directly 2015-12-16 20:36:11 +01:00
David Heinemeier Hansson
59db9ebc0c Cargo cult fix to make Celluloid behave 2015-12-16 20:36:11 +01:00
David Heinemeier Hansson
0036cb35b8 Require tree 2015-12-16 18:58:50 +01:00
David Heinemeier Hansson
70be2486f3 Simpler directory structure 2015-12-16 18:58:43 +01:00
David Heinemeier Hansson
0625d77784 Note that changes to the cable setup requires restarting the server 2015-12-16 18:23:11 +01:00
David Heinemeier Hansson
8e9b7c0405 @App could have been set elsewhere 2015-12-16 18:17:12 +01:00
David Heinemeier Hansson
910572fffe Another stab at only mounting redis if the config is there 2015-12-16 18:17:12 +01:00
David Heinemeier Hansson
7eb12796ca Assume that the cable server is running in-process by default, offer option to change that in config/environments/production.rb 2015-12-16 18:17:12 +01:00
David Heinemeier Hansson
aae14ab3ac Fix parent class 2015-12-16 18:17:12 +01:00
David Heinemeier Hansson
51ad57989d Doh, should have read ff370ee61754b00f864f3ddd0af62be4dfa0de67
Indeed we need this to be an engine for the internal assets to work
2015-12-16 15:52:46 +01:00
David Heinemeier Hansson
6bfd191c0f Only initialize redis if the config file is there 2015-12-16 15:42:35 +01:00
David Heinemeier Hansson
deac988756 Include changes made to the engine 2015-12-16 15:31:25 +01:00
David Heinemeier Hansson
26bcf81a01 Move Cable to ActionCable for client-side constant to avoid conflicts 2015-12-16 15:29:21 +01:00
David Heinemeier Hansson
346a7528ef We are using railtie, not engine 2015-12-16 15:28:50 +01:00
David Heinemeier Hansson
40cc72548f Basic channel generator 2015-12-15 21:39:22 +01:00
Rafael Mendonça França
649b9d9321 Move the require to the right place 2015-12-15 16:05:42 -02:00
Rafael Mendonça França
23faa711c9 Remove the default logger
It should be configured through the railtie
2015-12-15 16:02:47 -02:00
Rafael Mendonça França
96455349ff Configure the Action Cable's redis in the engine
This will decouple Action Cable from Rails.
2015-12-15 15:59:00 -02:00
claudiob
70e593d998 Remove rails/actioncable Travis badge
[ci skip]

Since Action Cable is getting integrated into rails/rails, the Travis
badge for rails/actioncable is not needed anymore.

Also following the standard of every other README to have `--` rather
than `-` to separating the name of the library from its description.
2015-12-15 09:25:15 -08:00
Rafael Mendonça França
ff370ee617 Action Cable need to be a engine
Otherwise assets will not work
2015-12-15 15:21:36 -02:00
Javan Makhmali
8625518725 Bring latest changes over from actioncable/master 2015-12-15 10:35:02 -05:00
David Heinemeier Hansson
a8db0328a5 Switch from engine to railtie 2015-12-15 13:10:27 +01:00
Rafael Mendonça França
3d4a423cdc Hook in ActionView::Base, not in ApplicationController
The application can have more than one ApplicationController and we
want Action Cable helpers in all controllers and their views so we
should hook in the same place that others helpers.
2015-12-14 15:54:08 -02:00
Rafael Mendonça França
f8058a6aeb Require the top level file in the engine 2015-12-14 15:53:43 -02:00
claudiob
f6fb71af8b Remove Alpha disclaimer from ActionCable
[ci skip] Getting to ready to merge into rails/rails
2015-12-14 08:24:06 -08:00
David Heinemeier Hansson
760de782f7 Initial stab at adding Action Cable to rails/master 2015-12-14 16:38:37 +01:00
David Heinemeier Hansson
bf40bddfce Get ready to merge into Rails 2015-12-14 15:48:54 +01:00