anycable-rails 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dab047473c94bb62b658e08d1aa99a4d64d9b0ab3fad5b7e335e19398a9d8c21
4
- data.tar.gz: 6ad5f84e8a4af9ee01f1e277c6c235b7c8d2d313ef369b54739051d499980360
3
+ metadata.gz: 249493f023d0c0b2e8f85bba263132f7b8bb440073184f68949e83b5911b191a
4
+ data.tar.gz: 055c60c21507d7307f73121948e134087d624f907d4435ad1ac0526337158464
5
5
  SHA512:
6
- metadata.gz: 3cadd3ebe73ebbd8ce2c2854cd663407a86195cb05ec2d9f4d85a512465ea0b6cba28e70b6eb49ca0b114be18943d67bee465ce795496f44bd84ed3f996dfc6a
7
- data.tar.gz: d07f875b9508e296188420166f9a1071a3fdec4a1cd5766c8ccc9cc277f49a25cd6eb3b3045b8ff59fc3057c2bb2d083a417f2c6641cbfe8929bfabe61be51bd
6
+ metadata.gz: 2aee411822afddc35aeecbf85490f413e2c6b899107b3a849e25a449cf19baf13885cad9e52bbc25ab85b08316b865ff60f0fc0f558f0ebffc0a175e5d983f30
7
+ data.tar.gz: e5933e165ca975e9ce32ec867b177583cc8e0718a9aa8f1f9435bbb515500a4f0de9e7cd82b34e7e0f9d1cf8db40114f0fedb49923ef63bfce418a9dd1cd7a76
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
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
+
5
11
  ## 1.3.2 (2022-03-04)
6
12
 
7
13
  - Allow Ruby 2.6.
@@ -1,6 +1,6 @@
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
6
  def subscribe_to_channel
@@ -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.2"
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.2
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-03-04 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
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
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