anycable-rails-core 1.5.0.rc.1 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/lib/anycable/rails/action_cable_ext/channel.rb +9 -1
- data/lib/anycable/rails/channel_state.rb +3 -2
- data/lib/anycable/rails/compatibility.rb +1 -1
- data/lib/anycable/rails/railtie.rb +0 -2
- data/lib/anycable/rails/version.rb +1 -1
- data/lib/anycable-rails-core.rb +3 -0
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 047a37c59ff5b5e9e0074302b02450b8e7ab78af36382db634843eb8d1e0a802
|
4
|
+
data.tar.gz: 92234b820387917f2f1321b1175b3f1bdfd6305d386320fefcbfc68384476f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86938782b2903250bf2a6fdfa205ff70f8356414c035e4d195c93967051fccc731d520b74b373b54ac74cbbd0b3182678b863a06f466ddd17926c2dba3209025
|
7
|
+
data.tar.gz: 2112a294b4fe22efd05835a2a93b60dfecaae996e990d8690af89d28017ae495d79df147b0cc451bb1a8ae429bceed594d38ded78c1b09de8518f20fe1075b55
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,21 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
-
## 1.5.
|
5
|
+
## 1.5.1 (2024-04-05)
|
6
|
+
|
7
|
+
- Add `anycable-rails-core.rb` to avoid adding `require: ["anycable-rails"]` to Gemfiles manually. ([@palkan][])
|
8
|
+
|
9
|
+
- Mount HTTP RPC independently of the current Action Cable adapter. ([@palkan][])
|
10
|
+
|
11
|
+
This makes it possible to use it in tests without manually adding the middleware.
|
12
|
+
|
13
|
+
## 1.5.0 (2024-04-01)
|
14
|
+
|
15
|
+
- Allow specifying the _whispering_ stream via `#stream_from(..., whisper: true)`. ([@palkan][])
|
16
|
+
|
17
|
+
You can use specify the stream to use for _whispering_ (client-initiated broadcasts) by adding `whisper: true` to the `#stream_from` (or `#stream_for`) method call.
|
18
|
+
|
19
|
+
NOTE: This feature is only supported when using AnyCable server and ignored otherwise.
|
6
20
|
|
7
21
|
- Support passing objects to `ActionCable.server.broadcast`. ([@palkan][])
|
8
22
|
|
@@ -22,12 +22,20 @@ ActionCable::Channel::Base.prepend(Module.new do
|
|
22
22
|
super unless anycabled?
|
23
23
|
end
|
24
24
|
|
25
|
-
def stream_from(broadcasting, _callback = nil, **)
|
25
|
+
def stream_from(broadcasting, _callback = nil, **opts)
|
26
|
+
whispering = opts.delete(:whisper)
|
26
27
|
return super unless anycabled?
|
27
28
|
|
28
29
|
broadcasting = String(broadcasting)
|
29
30
|
|
30
31
|
connection.anycable_socket.subscribe identifier, broadcasting
|
32
|
+
if whispering
|
33
|
+
connection.anycable_socket.whisper identifier, broadcasting
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def stream_for(model, callback = nil, **opts, &block)
|
38
|
+
stream_from(broadcasting_for(model), callback || block, **opts)
|
31
39
|
end
|
32
40
|
|
33
41
|
def stop_stream_from(broadcasting)
|
@@ -12,9 +12,10 @@ module AnyCable
|
|
12
12
|
return @#{name} if instance_variable_defined?(:@#{name})
|
13
13
|
return unless anycabled?
|
14
14
|
|
15
|
-
|
15
|
+
raw_val = __istate__["#{name}"]
|
16
|
+
val = raw_val.present? ? AnyCable::Serializer.deserialize(JSON.parse(raw_val)) : nil
|
16
17
|
|
17
|
-
@#{name} = val.
|
18
|
+
@#{name} = val.try(:with_indifferent_access) || val
|
18
19
|
end
|
19
20
|
|
20
21
|
def #{name}=(val)
|
@@ -11,7 +11,7 @@ module AnyCable
|
|
11
11
|
]
|
12
12
|
|
13
13
|
ActionCable::Channel::Base.prepend(Module.new do
|
14
|
-
def stream_from(broadcasting, callback = nil, coder: nil)
|
14
|
+
def stream_from(broadcasting, callback = nil, coder: nil, **)
|
15
15
|
if coder.present? && coder != ActiveSupport::JSON
|
16
16
|
raise AnyCable::CompatibilityError, "Custom coders are not supported by AnyCable"
|
17
17
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable-rails-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable-core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.0
|
19
|
+
version: 1.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.5.0
|
26
|
+
version: 1.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actioncable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- README.md
|
65
65
|
- lib/action_cable/subscription_adapter/any_cable.rb
|
66
66
|
- lib/action_cable/subscription_adapter/anycable.rb
|
67
|
+
- lib/anycable-rails-core.rb
|
67
68
|
- lib/anycable-rails.rb
|
68
69
|
- lib/anycable/rails.rb
|
69
70
|
- lib/anycable/rails/action_cable_ext/broadcast_options.rb
|
@@ -118,7 +119,7 @@ metadata:
|
|
118
119
|
homepage_uri: https://anycable.io/
|
119
120
|
source_code_uri: http://github.com/anycable/anycable-rails
|
120
121
|
funding_uri: https://github.com/sponsors/anycable
|
121
|
-
post_install_message:
|
122
|
+
post_install_message:
|
122
123
|
rdoc_options: []
|
123
124
|
require_paths:
|
124
125
|
- lib
|
@@ -129,12 +130,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '2.7'
|
130
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
132
|
requirements:
|
132
|
-
- - "
|
133
|
+
- - ">="
|
133
134
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
135
|
+
version: '0'
|
135
136
|
requirements: []
|
136
|
-
rubygems_version: 3.4.
|
137
|
-
signing_key:
|
137
|
+
rubygems_version: 3.4.19
|
138
|
+
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: AnyCable integration for Rails (w/o RPC dependencies)
|
140
141
|
test_files: []
|