anycable-rails 1.3.0 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37be6474db2d3efc3493ec6fdf5b3826fbdfd84f9c4bc5f4574f1e0497457ec1
4
- data.tar.gz: bafe87b642e1aaf15c5b09650ed271081d0ba53738507077ed1075b2de5e0ef2
3
+ metadata.gz: 249493f023d0c0b2e8f85bba263132f7b8bb440073184f68949e83b5911b191a
4
+ data.tar.gz: 055c60c21507d7307f73121948e134087d624f907d4435ad1ac0526337158464
5
5
  SHA512:
6
- metadata.gz: b656f5a17009a19aacef7c1aac587299b5bdca24079e3e6a1ce2c9e652e26a7d65f08e34f0022e1ed4a9e42d8783af9d7d9e85a9059577ec224a523b7c12378e
7
- data.tar.gz: 383c128d5404a7ed42bba43a426cb68bd10be23607557bce7a8ef46cd1ea1cf2777c918e44a4c71f307a0f973ff863aef36f547290ce821d65251e7f9a62a3fd
6
+ metadata.gz: 2aee411822afddc35aeecbf85490f413e2c6b899107b3a849e25a449cf19baf13885cad9e52bbc25ab85b08316b865ff60f0fc0f558f0ebffc0a175e5d983f30
7
+ data.tar.gz: e5933e165ca975e9ce32ec867b177583cc8e0718a9aa8f1f9435bbb515500a4f0de9e7cd82b34e7e0f9d1cf8db40114f0fedb49923ef63bfce418a9dd1cd7a76
data/CHANGELOG.md CHANGED
@@ -2,13 +2,29 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 1.3.0 (2021-02-21)
5
+ ## 1.3.3 (2022-04-20)
6
+
7
+ - Added `sid` (unique connection identifier) field to the `welcome` message if present. ([@palkan][])
8
+
9
+ - Fixed handling Ruby Logger incompatible loggers. ([@palkan][])
10
+
11
+ ## 1.3.2 (2022-03-04)
12
+
13
+ - Allow Ruby 2.6.
14
+
15
+ ## 1.3.1 (2022-02-28)
16
+
17
+ - Fix Action Cable Channel patch to not change methods signatures. ([@palkan][])
18
+
19
+ Otherwise it could lead to conflicts with other patches.
20
+
21
+ ## 1.3.0 (2022-02-21)
6
22
 
7
23
  - Introduce `AnyCable::Rails.extend_adapter!` to make any pubsub adapter AnyCable-compatible. ([@palkan][])
8
24
 
9
25
  - Refactored Action Cable patching to preserve original functionality and avoid monkey-patching collisions. ([@palkan][])
10
26
 
11
- ## 1.2.1 (2021-01-31)
27
+ ## 1.2.1 (2022-01-31)
12
28
 
13
29
  - Add a temporary fix to be compatible with `sentry-rails`. ([@palkan][])
14
30
 
@@ -1,15 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "action_cable/channel"
3
+ require "action_cable"
4
4
 
5
5
  ActionCable::Channel::Base.prepend(Module.new do
6
- def subscribe_to_channel(force: false)
7
- return if anycabled? && !force
8
- super()
6
+ def subscribe_to_channel
7
+ super unless anycabled? && !@__anycable_subscribing__
9
8
  end
10
9
 
11
10
  def handle_subscribe
12
- subscribe_to_channel(force: true)
11
+ @__anycable_subscribing__ = true
12
+ subscribe_to_channel
13
+ ensure
14
+ @__anycable_subscribing__ = false
13
15
  end
14
16
 
15
17
  def start_periodic_timers
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "action_cable/connection"
3
+ require "action_cable"
4
4
  require "anycable/rails/connections/serializable_identification"
5
5
 
6
6
  ActionCable::Connection::Base.include(AnyCable::Rails::Connections::SerializableIdentification)
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "action_cable/connection"
4
- require "action_cable/channel"
3
+ require "action_cable"
5
4
 
6
5
  module AnyCable
7
6
  module Rails
@@ -13,8 +12,11 @@ module AnyCable
13
12
  :anycable_socket
14
13
 
15
14
  # Using public :send_welcome_message causes stack level too deep 🤷🏻‍♂️
16
- def public_send_welcome_message
17
- send_welcome_message
15
+ def send_welcome_message
16
+ transmit({
17
+ type: ActionCable::INTERNAL[:message_types][:welcome],
18
+ sid: env["anycable.sid"]
19
+ }.compact)
18
20
  end
19
21
 
20
22
  def public_request
@@ -92,7 +94,7 @@ module AnyCable
92
94
 
93
95
  socket.cstate.write(LOG_TAGS_IDENTIFIER, logger.tags.to_json) unless logger.tags.empty?
94
96
 
95
- conn.public_send_welcome_message
97
+ conn.send_welcome_message
96
98
  rescue ::ActionCable::Connection::Authorization::UnauthorizedError
97
99
  reject_request(
98
100
  ActionCable::INTERNAL[:disconnect_reasons]&.[](:unauthorized) || "unauthorized"
@@ -20,13 +20,14 @@ module AnyCable
20
20
  AnyCable.logger = ::ActionCable.server.config.logger
21
21
 
22
22
  AnyCable.configure_server do
23
- AnyCable.logger = ActiveSupport::TaggedLogging.new(::ActionCable.server.config.logger)
23
+ server_logger = AnyCable.logger = ::ActionCable.server.config.logger
24
+ AnyCable.logger = ActiveSupport::TaggedLogging.new(server_logger) if server_logger.is_a?(::Logger)
24
25
  # Broadcast server logs to STDOUT in development
25
26
  if ::Rails.env.development? &&
26
27
  !ActiveSupport::Logger.logger_outputs_to?(::Rails.logger, $stdout)
27
28
  console = ActiveSupport::Logger.new($stdout)
28
- console.formatter = ::Rails.logger.formatter
29
- console.level = ::Rails.logger.level
29
+ console.formatter = ::Rails.logger.formatter if ::Rails.logger.respond_to?(:formatter)
30
+ console.level = ::Rails.logger.level if ::Rails.logger.respond_to?(:level)
30
31
  AnyCable.logger.extend(ActiveSupport::Logger.broadcast(console))
31
32
  end
32
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.3.0"
5
+ VERSION = "1.3.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-21 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anycable
@@ -198,14 +198,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: '2.7'
201
+ version: '2.6'
202
202
  required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - ">="
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.2.22
208
+ rubygems_version: 3.3.7
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Rails adapter for AnyCable