Commit Graph

38 Commits

Author SHA1 Message Date
Xavier Noria
b7ae3cba6d Load with Zeitwerk 2022-03-05 08:19:49 +01:00
Atul Bhosale
ec69083cf3
Add method ActionCable::Channel#stream_or_reject_for to stream if record is present, otherwise reject the connection (#38375) 2020-03-07 10:09:08 -08:00
Zhang Kang
96b74fe433 Introduce ActionCable::Channel#stop_stream_from/for to unsubscribe specific streams (#37171)
* Like `ActionCable::Channel#stop_all_streams`, but for specific streams
2020-01-17 13:39:06 -08:00
Akira Matsuda
9a15149dab Keyword arguments is not a Hash 2019-09-07 03:20:07 +09:00
R.T. Lechow
badb910b54 Fix typos
Fixes some typos.
2018-10-01 19:56:50 -04:00
Sakshi Jain
0fe2bb816f Remove private def 2018-09-23 21:27:44 +05:30
bogdanvlviv
74a9a29277
Include ActiveSupport::Testing::MethodCallAssertions to ActionCable::TestCase
Remove all `include ActiveSupport::Testing::MethodCallAssertions`
in actioncable's tests since we can do it only in `ActionCable::TestCase`
in order to prevent code duplication.
We use the same approach for other modules of Rails.
2018-06-08 23:29:05 +03:00
utilum
a0ea528b61 Use Ruby instead of mocha 2018-05-31 17:48:20 +02:00
utilum
84854d9d05 Use minitest/mock instead of mocha 2018-05-31 17:48:20 +02:00
bogdanvlviv
d66d3a4bd1
Fix actionable test's assertion
Pull Request #32727 changed "mocha expects" in favor of `MethodCallAssertions`.
This commit fixes assertion that became less strict after the PR.
2018-05-28 09:20:24 +00:00
utilum
78288f75e1 remove unnecessary mocking in ActionCable tests 2018-05-22 02:29:18 +02:00
utilum
94ceda00b9 assert_called 2018-04-26 08:02:08 +02:00
utilum
86cafe7c9d 2.6 warning: passing splat keyword arguments as a single Hash
Ruby 2.6.0 warns about this.

``` ruby -v
ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux]
```

Before, see:
https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264
https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174
2018-04-15 10:09:38 +02:00
Daniel Colson
94333a4c31 Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
Daniel Colson
211adb47e7 Change refute to assert_not 2018-01-25 23:32:58 -05:00
Koichi ITO
7c260ae201 Fix RuboCop offenses
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
2017-08-16 17:55:25 +09:00
Kir Shatrov
385825fb70 Use frozen string literal in actioncable/ 2017-07-23 23:30:29 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Matthew Draper
62a8e838e0 Fix a race in ActionCable stream tests
These tests double-stub connection.pubsub, so we need to ensure the
first call's completed before we set up for the second.
2017-03-23 05:52:38 +10:30
palkan
3e68d8b872 Add Channel#ensure_confirmation_sent; call #subscribe_to_channel after initializing 2016-09-22 20:25:09 +03:00
palkan
03a209e92a [Fix #25381] Avoid race condition on subscription confirmation 2016-09-20 19:42:24 +03:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
f8477f13bf applies new string literal convention in actioncable/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:15:15 +02:00
Matthew Draper
a8df1bc345 Properly support reloading for Action Cable channels 2016-06-02 04:08:48 +09: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
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
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
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
Jay Hayes
b426247250 whitespace 2016-02-24 12:42:55 -06:00
Matthew Draper
74497eabd5 Revert "Revert "Eliminate the EventMachine dependency"" 2016-01-30 03:46:37 +10:30
David Heinemeier Hansson
9ea7aa84d1 Revert "Eliminate the EventMachine dependency" 2016-01-27 14:33:15 +01:00
Matthew Draper
68a9060d02 Using a hacked faye-websocket, drop EventMachine 2016-01-24 22:51:06 +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
6aeaed4c1a All Redis deps are now optional, Postgres --> PostgreSQL adapter 2016-01-18 18:59:30 -05:00
Jon Moss
bc413e814b Tests passing and small refactoring 2016-01-18 18:59:01 -05:00
Arun Agrawal
e1459c7c86 Remove warnings from actioncable
Warnings coming from code and test are removed
2015-12-17 16:42:34 +01:00
David Heinemeier Hansson
bf40bddfce Get ready to merge into Rails 2015-12-14 15:48:54 +01:00