aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/channel/streams.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move `channel_name` to Channel.broadcasting_forVladimir Dementyev2019-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That would allow us to test broadcasting made with channel, e.g.: ```ruby class ChatRelayJob < ApplicationJob def perform_later(room, msg) ChatChannel.broadcast_to room, message: msg end end ``` To test this functionality we need to know the underlying stream name (to use `assert_broadcasts`), which relies on `channel_name`. We had to use the following code: ```ruby assert_broadcasts(ChatChannel.broadcasting_for([ChatChannel.channel_name, room]), 1) do ChatRelayJob.perform_now end ``` The problem with this approach is that we use _internal_ API (we shouldn't care about `channel_name` prefix in our code). With this commit we could re-write the test as following: ```ruby assert_broadcasts(ChatChannel.broadcasting_for(room), 1) do ChatRelayJob.perform_now end ```
* Use frozen string literal in actioncable/Kir Shatrov2017-07-231-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Merge pull request #26547 from ↵Matthew Draper2016-10-011-1/+1
|\ | | | | | | | | | | palkan/fix/actioncable-confirmation-race-condition Avoid race condition on subscription confirmation
| * Add Channel#ensure_confirmation_sent; call #subscribe_to_channel after ↵palkan2016-09-221-2/+1
| | | | | | | | initializing
| * [Fix #25381] Avoid race condition on subscription confirmationpalkan2016-09-201-1/+2
| |
* | [ci fix] Fix API documentation for Streams module from Action CablePrathamesh Sonpatki2016-09-061-4/+4
|/
* fix grammarRajat Bansal2016-05-311-1/+1
|
* 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.
* Merge pull request #24600 from tomkadwill/action-cabel-channel-typosVipul A M2016-04-181-1/+1
|\ | | | | Fix typos in ActionCable Channel [ci skip]
| * Fix typos in ActionCable Channel [ci skip]Tom Kadwill2016-04-181-1/+1
| |
* | 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-311-11/+21
| | | | | | | | | | | | | | | | | | | * 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.
* Support faye-websocket + EventMachine as an optionMatthew Draper2016-03-021-1/+1
|
* 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-271-1/+1
|/ | | | | * Fix typos/grammar errors * Make capitalization/naming consistent
* Full Action Cable documentation read throughJon Moss2016-02-171-7/+9
| | | | | | | | | 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]
* [ci skip] Several ActionCable documentation updates:Nick Quaranto2016-02-021-12/+14
| | | | | | | | * 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-301-1/+1
|
* Revert "Eliminate the EventMachine dependency"David Heinemeier Hansson2016-01-271-1/+1
|
* Using a hacked faye-websocket, drop EventMachineMatthew Draper2016-01-241-1/+1
|
* 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
|
* Get ready to merge into RailsDavid Heinemeier Hansson2015-12-141-0/+114