Commit Graph

673 Commits

Author SHA1 Message Date
mansakondo
3a6ab41595 Fix #45738 2022-09-25 14:57:32 +02:00
MSP-Greg
6c674e4425
Updates for Puma 6 2022-09-22 12:40:54 -05:00
Mansa Keïta
09152576d6
Add CHANGELOG entry for #45738 [ci-skip] (#46056) 2022-09-17 19:34:21 +05:30
mansakondo
27a967ef70 Add ability to handle reconnects with the connected() callback 2022-09-14 12:14:58 +02:00
Kim Yu Ng
cbc56b6a9e prevent leaking sensitive payload 2022-08-25 10:07:23 -05:00
Jean Boussier
7587b7e99a Action Cable redis-rb 5+ compatibility
- Pass configuration as symbols
- Stop messing with the raw client
2022-08-22 09:01:27 +02:00
Jean Boussier
71c24aa0bc Refactor Action Cable's Redis adapter to isolate the layer breach 2022-08-22 09:01:27 +02:00
Jean Boussier
7559957ba2 Require redis 4+ in Action Cable
RedisCacheStore already does, no point keeping compatiblity
with 3.x.

Redis 4+ always responds to `_client` so we can simplify the code.
2022-08-22 09:01:27 +02:00
Jean Boussier
f2ab66da73 Stop testing hiredis
The driver being used is an implementation detail of `redis-rb`.
If somehow something break on one driver but not the other, it should
be reported to redis-rb and fixed there.

Also `redis-rb` `5.0` has a totally new client and hiredis binding
so all this code no longer works with redis-rb 5.0.
2022-08-22 09:01:27 +02:00
Erol Fornoles
69c8b6b3d1
Correct the description for reject_unauthorized_connection 2022-08-08 09:23:01 +08:00
Alex Ghiculescu
1ee984dfe4 Anchor the Action Cable server's route
Fixes https://github.com/rails/rails/issues/45489

- Adds `anchor: true` to the Action Cable server mount, so that it only strictly matches `/cable` rather than anything that starts with that.
- Uses `reverse_merge` instead of `merge` in `Mapper#mount`, so that you can override these options if you need to.
2022-06-29 13:26:49 -05:00
Gannon McGibbon
19875bedd7 Improve channel generator usage docs
- Makes heading styles consistent with other generators
- Adds backticks to code snippets
- Adds more examples
2022-06-21 00:30:37 -05:00
Dominik Malis
cef3342e40
Connections Map changed to Each in ping task
No need to make new array containing all connections because returned value of map is not used
2022-06-16 13:20:14 +02:00
Xavier Noria
3bcd48f6d8 Require Zeitwerk 2.6 2022-06-13 23:43:42 +02:00
Jean Boussier
115be62709 Wrap rails runner in executor
The main reason is to automatically report uncaught exceptions
since `rails runner` is often used for cron tasks and such.
2022-06-10 14:16:49 +02:00
Gannon McGibbon
3dad2919d5 Rename behaviour to behavior in documentation 2022-05-26 17:14:18 -04:00
Jeremy Daer
df88a42e5f Merge branch 'main' into feat/ac-remote-disconnect-notice
* main: (21 commits)
  feat: action cable connection callbacks
  fix: action cable stream_test errors
  Adds test coverage for #attach method behaviour in activestorage
  Address QueryCacheTest#test_query_cache_does_not_allow_sql_key_mutation failure
  Fixes ActiveStorage proxy downloads of files over 5mb in S3-like storage services
  Fixes development Action Mailbox new mail form
  Squash commits
  Include the unexpected class in InvalidParameterKey message
  Support unbounded time ranges for PostgreSQL
  Fix CHANGELOG alignment [ci-skip]
  Add ability to ignore tables by regexp for SQL schema dumps
  Improve `rails s` error message when no server could be found.
  Fix MySQL warning when creating Active Record's test databases
  Add `--js` and --skip-javascript` options to `rails new`
  Fix parsing operator classes for index columns in PostgreSQL
  Fix rails test command to handle leading dot slash
  Document that url_for can take classes
  Don't change the encoding of frozen parameters
  Update working_with_javascript_in_rails.md
  Avoid query from calculations on contradictory relation
  ...
2022-05-16 12:40:31 -07:00
Vladimir Dementyev
5d6c1f64ea feat: action cable connection callbacks 2022-05-16 12:24:38 -07:00
Vladimir Dementyev
c5423e9a9c fix: action cable stream_test errors 2022-05-16 12:22:09 -07:00
Vladimir Dementyev
2d0f9c5844 Send disconnect message during remote disconnect
Send {type: :disconnect} message to a client before closing the connection when initiated by server.remote_connections.where(...).disconnect
2022-05-11 13:59:23 -04:00
Ghouse Mohamed
6ee6cb554b Fix #version docs and some typos 2022-03-16 01:48:37 +05:30
Xavier Noria
645239817d Refactor Zeitwerk setup in Action Cable
I am trying to find a sweet spot here.

Personally, not quite satisfied by having lib/action_cable/zeitwerk.rb. At the
same time, trying to avoid too taking much space in lib/action_cable.rb.

This patch also moves

    require_relative "action_cable/version"

within ActionCable. Why? In a project, I like that the entrypoint defines the
namespace. That is the main file for that namespace.

Then, files below have it already created, and reopen it.

I just find this deliberate order of execution to be natural, hierarchical,
matching the project structure.
2022-03-06 19:52:36 +01:00
Xavier Noria
61bbcb71d5 Add missing magic comment (linting) 2022-03-05 14:25:52 +01:00
Xavier Noria
a0e75d76ab Setup Zeitwerk in a dedicated file 2022-03-05 14:05:34 +01:00
Xavier Noria
a3f4ae9a2d Remove require "thread" from Action Cable
Not needed since Ruby 2.1.
2022-03-05 08:56:09 +01:00
Xavier Noria
b7ae3cba6d Load with Zeitwerk 2022-03-05 08:19:49 +01:00
Jonathan Hefner
a199aaedb8 Cross-link API docs [ci-skip]
RDoc will automatically format and link API references as long as they
are not already marked up as inline code.

This commit removes markup from various API references so that those
references will link to the relevant API docs.
2022-02-21 11:45:25 -06:00
Jonathan Hefner
e37adfed4e Add Oxford commas [ci-skip] 2022-02-21 11:11:11 -06:00
Jonathan Hefner
0d3effc97e Replace "overwrite" with "override" [ci-skip]
"Overwrite" means "destructively replace", and is more suitable when,
for example, talking about writing data to a location.

"Override" means "supersede", and is more suitable when, for example,
talking about redifining methods in a subclass.
2022-02-21 11:11:11 -06:00
Jonathan Hefner
5fdbd217d1 Fix typos [ci-skip] 2022-02-21 11:11:11 -06:00
Jorge Manrubia
ed8e767218
Only close websockets when connection is open (#44304)
This addresses a problem where Safari's websockets gets permanently broken
when closing them in a "connecting" state.

See https://github.com/rails/rails/issues/43835#issuecomment-1002288478
2022-02-02 15:50:34 +01:00
jlestavel
2197814074
Allow app to opt out of precompiling activestorage js assets (#43967) 2022-01-18 18:19:30 +01:00
Ryuta Kamizono
65766ebcc8 Bump license years to 2022 [ci-skip] 2022-01-01 15:22:15 +09:00
Rafael Mendonça França
83d85b2207
Start Rails 7.1 development 2021-12-07 15:52:30 +00:00
Rafael Mendonça França
8160e25de0
Merge pull request #43591 from SkipKayhil/fix-actioncable-js-module
fix actioncable module field in package.json
2021-12-03 15:32:32 -05:00
Rafael Mendonça França
1fde031e89 Fix gemspec 2021-11-15 21:06:21 +00:00
Rafael Mendonça França
9195b7fd0a
Require MFA to release rails 2021-11-15 20:37:42 +00:00
Tanaka
6fee8be7fd
Add actioncable assets to gemspec.
actioncable.js and actioncable.esm.js is not included to gem package. It prevented us from using the action cable when using importmaps.

This adds the missing asset files to gem package.
2021-11-12 05:56:16 +09:00
Hartley McGuire
9dcd7099fa fix actioncable module field in package.json
The current module field points to a file that isn't included in the
files field of actioncable's package.json. This leads to errors when
trying to use actioncable in bundlers that use esm modules natively
(like Vite)
2021-11-03 21:24:20 -04:00
George Claghorn
426c69fd39 Action Cable: use non-deprecated entrypoint for JS package 2021-10-27 21:34:23 -04:00
Dan Spinosa
6d7c12274e
Client ensures subscribe command is confirmed. (#41581)
A SubscriptionGuarantor maintains a set of pending subscriptions,
resending the subscribe command unless and until the subscription
is confirmed or rejected by the server or cancelled client-side.

A race condition in the ActionCable server - where an unsubscribe
is sent, followed rapidly by a subscribe, but handled in the reverse
order - necessitates this enhancement.  Indeed, the subscriptions created
and torn down by Turbo Streams amplifies the existence of this race
condition.
2021-09-26 10:06:27 -07:00
Rafael Mendonça França
386ab893f6
Use regular memoization
`connection_gid` always return something so we don't need to use
`defined?`.
2021-09-23 19:23:27 -04:00
Rafael França
ddaf3b2cb3
Merge pull request #42574 from leastbad/connection_identifier
add connection_identifier to ConnectionStub
2021-09-23 19:19:07 -04:00
Rafael Mendonça França
d177551c30
Preparing for 7.0.0.alpha2 release 2021-09-15 18:22:51 -04:00
Rafael Mendonça França
9b7be48212
Preparing for 7.0.0.alpha1 release 2021-09-15 17:55:08 -04:00
luizkowalski
868a63c695 Update guide and actioncable tests to use appropriate concurrent-ruby class 2021-09-15 17:50:49 +02:00
Xavier Noria
89801b2a43 Depend on ruby/debug, replacing Byebug
ruby/debug is a new debugger that is going to ship with CRuby.

It makes sense for Rails to switch to this one because that is
where the language is heading, and because Byebug is not fully
compatible with Zeitwerk. See

    https://github.com/deivid-rodriguez/byebug/issues/564

While ruby/debug has not been heavily tested with Zeitwerk,
casual usage seems to suggest it works without issues, including
explicit namespaces, which is where Byebug and Zeitwerk conflict.

Byebug is terrific, thanks a lot for all these years. ❤️
2021-09-08 17:35:41 +02:00
Jean Boussier
c91c266872 Enable Style/ExplicitBlockArgument cop
This reduce the stack size which is beneficial for
exceptions performance.

See: https://gist.github.com/byroot/cb3bcadcc3701c2518d002fb8d3a4e7a

However the cop is unsafe because it might change the block arity,
so it can run into some false positives.
2021-09-05 17:06:19 +02:00
Jose Galisteo
86ee45477c Fix rubocop offense 2021-09-04 20:48:35 +02:00
David Heinemeier Hansson
abc042cf9e Fix trailing whitespace 2021-09-04 19:47:32 +02:00