aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/channel
Commit message (Collapse)AuthorAgeFilesLines
* Add Missing ActiveSupport::Rescuable to ActionCable::ChannelIlia Kasianenko2018-12-121-0/+4
| | | | [timthez, Ilia Kasianenko]
* Fix typosR.T. Lechow2018-10-011-2/+2
| | | | Fixes some typos.
* Remove Rails 5.0 workaround from ActionCable::Channel::TestCaseVladimir Dementyev2018-09-271-6/+2
| | | | | | | The hack was merged from action-cable-testing gem by mistake. We don't need it in Rails 6. (cherry picked from commit 92030ec4b4309835ed0e792229984a1f0a044cef)
* Add ActionCable::Channel::TestCaseVladimir Dementyev2018-09-261-0/+275
| | | | | | | | | | | ActionCable::Channel::TestCase provides an ability to unit-test channel classes. There are several reasons to write unit/functional cable tests: - Access control (who has access to the channel? who can perform action and with which argument? - Frontend-less applications have no system tests at all–and we still need a way to test channels logic. See also #27191
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Class methods in the `class_methods` blocks are wrongly appeared in the docRyuta Kamizono2018-04-043-3/+3
| | | | | | | It is wrongly appeared as instance public methods in the doc. http://api.rubyonrails.org/v5.1.6/classes/ActionCable/Channel/Callbacks.html http://api.rubyonrails.org/v5.1.6/classes/ActiveRecord/Timestamp.html
* Use frozen string literal in actioncable/Kir Shatrov2017-07-236-1/+11
|
* Make actioncable ready for frozen stringsKir Shatrov2017-07-231-1/+5
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-026-6/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-016-0/+6
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+1
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* Move some ActionCable logs to debug levelMartijn Storck2017-02-061-1/+1
|
* Privatize unneededly protected methods in Action CableAkira Matsuda2016-12-241-14/+13
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Merge pull request #26547 from ↵Matthew Draper2016-10-012-17/+23
|\ | | | | | | | | | | palkan/fix/actioncable-confirmation-race-condition Avoid race condition on subscription confirmation
| * Add Channel#ensure_confirmation_sent; call #subscribe_to_channel after ↵palkan2016-09-222-25/+20
| | | | | | | | initializing
| * [Fix #25381] Avoid race condition on subscription confirmationpalkan2016-09-202-9/+20
| |
* | [ci fix] Fix API documentation for Streams module from Action CablePrathamesh Sonpatki2016-09-061-4/+4
|/
* Prevent invocation of channel action if rejected connectionJon Moss2016-08-191-1/+1
| | | | | | | | | 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.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies new string literal convention in actioncable/libXavier Noria2016-08-065-8/+8
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Periodic timers: delegate async instance_exec to the worker poolJeremy Daer2016-06-291-3/+1
|
* fix grammarRajat Bansal2016-05-311-1/+1
|
* Improve method descriptionRoman Pushkin2016-05-181-0/+1
| | | Method description improved to reflect little bit more complicated scenario when names are camel-cased.
* Fix code formatting in docsJay Hayes2016-05-031-2/+2
|
* Cable: Extract stream handler constructionJeremy Daer2016-04-181-10/+52
| | | | | | | | * 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.
* Cable: Periodic timers refreshJeremy Daer2016-04-181-7/+45
| | | | | | | | | * 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
* Merge pull request #24600 from tomkadwill/action-cabel-channel-typosVipul A M2016-04-182-3/+3
|\ | | | | Fix typos in ActionCable Channel [ci skip]
| * Fix typos in ActionCable Channel [ci skip]Tom Kadwill2016-04-182-3/+3
| |
* | Run Action Cable callbacks through the worker poolSean Griffin2016-04-131-2/+5
|/ | | | | | | | | | 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]
* Cable message encodingJeremy Daer2016-03-312-14/+24
| | | | | | | | | | | | | | | | | | | * 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.
* Keep logging in the ActionCable::Channel::BaseRafael Mendonça França2016-03-302-41/+6
| | | | | | 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.
* Add AS::Notifications and LogSubscriber to ActionCable::ChannelMatthew Wear2016-03-042-8/+56
| | | | | This commit adds ActiveSupport::Notifications instrumentation hooks and a LogSuscriber to ActionCable::Channel::Base.
* Support faye-websocket + EventMachine as an optionMatthew Draper2016-03-022-2/+2
|
* Merge pull request #23811 from iamvery/string-channelDavid Heinemeier Hansson2016-02-281-0/+1
|\ | | | | Ensure actioncable behaves as expected with non-string queues
| * Convert stream broadcasting to a stringJay Hayes2016-02-241-0/+1
| | | | | | | | | | | | | | 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.
* | Add small Action Cable documentation fixesHayley Anderson2016-02-272-2/+2
|/ | | | | * Fix typos/grammar errors * Make capitalization/naming consistent
* Merge pull request #23668 from maclover7/cable-docsRafael França2016-02-222-17/+17
|\ | | | | Full Action Cable documentation read through
| * Full Action Cable documentation read throughJon Moss2016-02-172-17/+17
| | | | | | | | | | | | | | | | | | 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]
* | Fixed typoChashmeet Singh2016-02-211-1/+1
| |
* | Truncate ActionCable broadcast message to 300 charsJankees van Woezik2016-02-181-1/+1
|/ | | | | | 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.
* [ci skip] Several ActionCable documentation updates:Nick Quaranto2016-02-022-24/+35
| | | | | | | | * 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
* Revert "Revert "Eliminate the EventMachine dependency""Matthew Draper2016-01-302-3/+3
|
* Revert "Eliminate the EventMachine dependency"David Heinemeier Hansson2016-01-272-3/+3
|
* Using a hacked faye-websocket, drop EventMachineMatthew Draper2016-01-242-3/+3
|
* Normalize on no arguments for the success callbackMatthew Draper2016-01-241-1/+1
|
* Fix code review commentsJon Moss2016-01-181-3/+3
| | | | | | | - 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
* Pull the action methods directly onto the adapterMatthew Draper2016-01-181-4/+4
|
* Adapterize ActionCable storage and extract behaviorJon Moss2016-01-181-2/+2
|
* Revert "Merge pull request #22977 from rails/revert-22934-master"David Heinemeier Hansson2016-01-161-1/+1
| | | | | This reverts commit d0393fccffc118a5de37654aa222774b66123393, reversing changes made to 3b7ccadfc1c8dfec61af898167e1300b17f5cf25.