packwerk 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +29 -20
- data/.github/workflows/cla.yml +22 -0
- data/.rubocop.yml +48 -19
- data/Gemfile +7 -2
- data/Gemfile.lock +201 -175
- data/README.md +1 -1
- data/RESOLVING_VIOLATIONS.md +81 -0
- data/Rakefile +1 -1
- data/USAGE.md +14 -5
- data/bin/m +1 -1
- data/bin/rake +1 -1
- data/bin/rubocop +1 -1
- data/bin/srb +1 -1
- data/bin/tapioca +1 -1
- data/gemfiles/Gemfile-rails-6-0 +1 -1
- data/gemfiles/Gemfile-rails-6-1 +22 -0
- data/lib/packwerk/application_validator.rb +7 -6
- data/lib/packwerk/association_inspector.rb +17 -15
- data/lib/packwerk/cache.rb +36 -29
- data/lib/packwerk/cli.rb +5 -6
- data/lib/packwerk/const_node_inspector.rb +8 -7
- data/lib/packwerk/constant_name_inspector.rb +2 -2
- data/lib/packwerk/deprecated_references.rb +34 -19
- data/lib/packwerk/file_processor.rb +14 -14
- data/lib/packwerk/files_for_processing.rb +27 -31
- data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
- data/lib/packwerk/formatters/progress_formatter.rb +2 -2
- data/lib/packwerk/node.rb +1 -294
- data/lib/packwerk/node_helpers.rb +335 -0
- data/lib/packwerk/node_processor.rb +6 -5
- data/lib/packwerk/node_processor_factory.rb +3 -3
- data/lib/packwerk/node_visitor.rb +1 -1
- data/lib/packwerk/offense_collection.rb +6 -3
- data/lib/packwerk/offenses_formatter.rb +2 -2
- data/lib/packwerk/package.rb +3 -0
- data/lib/packwerk/package_set.rb +2 -0
- data/lib/packwerk/parse_run.rb +15 -13
- data/lib/packwerk/parsed_constant_definitions.rb +23 -20
- data/lib/packwerk/parsers/erb.rb +3 -3
- data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
- data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
- data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
- data/lib/packwerk/reference_checking/reference_checker.rb +3 -1
- data/lib/packwerk/reference_extractor.rb +51 -48
- data/lib/packwerk/reference_offense.rb +3 -27
- data/lib/packwerk/run_context.rb +3 -3
- data/lib/packwerk/spring_command.rb +1 -1
- data/lib/packwerk/version.rb +1 -1
- data/lib/packwerk.rb +1 -0
- data/packwerk.gemspec +4 -12
- data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
- data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
- data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
- data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
- data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
- data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
- data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
- data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
- data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
- data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
- data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
- data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
- data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
- data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
- data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
- data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
- data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
- data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
- data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
- data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
- data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
- data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
- data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
- data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
- data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
- data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
- data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
- data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
- data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
- data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
- data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
- data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
- data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
- data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
- data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
- data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
- data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
- data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
- data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
- data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
- data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
- data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
- data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
- data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
- data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
- data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
- data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
- data/sorbet/rbi/shims/psych.rbi +5 -0
- data/sorbet/tapioca/require.rb +2 -3
- metadata +88 -157
- data/.github/probots.yml +0 -2
- data/library.yml +0 -6
- data/service.yml +0 -1
- data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
- data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
- data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
- data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
- data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
- data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
- data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
- data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
- data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
- data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
- data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
- data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
- data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
- data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
- data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
- data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
- data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
- data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
- data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
- data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
- data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
- data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
- data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
- data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
- data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
- data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
- data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
- data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
- data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
- data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
- data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
- data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
- data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
- data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
- data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
- data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
- data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
- data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
- data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
- data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
- data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
- data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
- data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
- data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
- data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
- data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
- data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
- data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
- data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
- data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
- data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
- data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
- data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
- data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
- data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
- data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
- data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
@@ -0,0 +1,2754 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `actioncable` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem actioncable`.
|
6
|
+
|
7
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:3
|
8
|
+
module ActionCable
|
9
|
+
extend ::ActiveSupport::Autoload
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Singleton instance of the server
|
14
|
+
#
|
15
|
+
# source://actioncable-7.0.3.1/lib/action_cable.rb:51
|
16
|
+
def server; end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
# Returns the currently loaded version of Action Cable as a <tt>Gem::Version</tt>.
|
20
|
+
#
|
21
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:5
|
22
|
+
def gem_version; end
|
23
|
+
|
24
|
+
# Singleton instance of the server
|
25
|
+
#
|
26
|
+
# source://actioncable-7.0.3.1/lib/action_cable.rb:51
|
27
|
+
def server; end
|
28
|
+
|
29
|
+
# Returns the currently loaded version of Action Cable as a <tt>Gem::Version</tt>.
|
30
|
+
#
|
31
|
+
# source://actioncable-7.0.3.1/lib/action_cable/version.rb:7
|
32
|
+
def version; end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel.rb:4
|
37
|
+
module ActionCable::Channel
|
38
|
+
extend ::ActiveSupport::Autoload
|
39
|
+
end
|
40
|
+
|
41
|
+
# The channel provides the basic structure of grouping behavior into logical units when communicating over the WebSocket connection.
|
42
|
+
# You can think of a channel like a form of controller, but one that's capable of pushing content to the subscriber in addition to simply
|
43
|
+
# responding to the subscriber's direct requests.
|
44
|
+
#
|
45
|
+
# Channel instances are long-lived. A channel object will be instantiated when the cable consumer becomes a subscriber, and then
|
46
|
+
# lives until the consumer disconnects. This may be seconds, minutes, hours, or even days. That means you have to take special care
|
47
|
+
# not to do anything silly in a channel that would balloon its memory footprint or whatever. The references are forever, so they won't be released
|
48
|
+
# as is normally the case with a controller instance that gets thrown away after every request.
|
49
|
+
#
|
50
|
+
# Long-lived channels (and connections) also mean you're responsible for ensuring that the data is fresh. If you hold a reference to a user
|
51
|
+
# record, but the name is changed while that reference is held, you may be sending stale data if you don't take precautions to avoid it.
|
52
|
+
#
|
53
|
+
# The upside of long-lived channel instances is that you can use instance variables to keep reference to objects that future subscriber requests
|
54
|
+
# can interact with. Here's a quick example:
|
55
|
+
#
|
56
|
+
# class ChatChannel < ApplicationCable::Channel
|
57
|
+
# def subscribed
|
58
|
+
# @room = Chat::Room[params[:room_number]]
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# def speak(data)
|
62
|
+
# @room.speak data, user: current_user
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# The #speak action simply uses the Chat::Room object that was created when the channel was first subscribed to by the consumer when that
|
67
|
+
# subscriber wants to say something in the room.
|
68
|
+
#
|
69
|
+
# == Action processing
|
70
|
+
#
|
71
|
+
# Unlike subclasses of ActionController::Base, channels do not follow a RESTful
|
72
|
+
# constraint form for their actions. Instead, Action Cable operates through a
|
73
|
+
# remote-procedure call model. You can declare any public method on the
|
74
|
+
# channel (optionally taking a <tt>data</tt> argument), and this method is
|
75
|
+
# automatically exposed as callable to the client.
|
76
|
+
#
|
77
|
+
# Example:
|
78
|
+
#
|
79
|
+
# class AppearanceChannel < ApplicationCable::Channel
|
80
|
+
# def subscribed
|
81
|
+
# @connection_token = generate_connection_token
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# def unsubscribed
|
85
|
+
# current_user.disappear @connection_token
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# def appear(data)
|
89
|
+
# current_user.appear @connection_token, on: data['appearing_on']
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# def away
|
93
|
+
# current_user.away @connection_token
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# private
|
97
|
+
# def generate_connection_token
|
98
|
+
# SecureRandom.hex(36)
|
99
|
+
# end
|
100
|
+
# end
|
101
|
+
#
|
102
|
+
# In this example, the subscribed and unsubscribed methods are not callable methods, as they
|
103
|
+
# were already declared in ActionCable::Channel::Base, but <tt>#appear</tt>
|
104
|
+
# and <tt>#away</tt> are. <tt>#generate_connection_token</tt> is also not
|
105
|
+
# callable, since it's a private method. You'll see that appear accepts a data
|
106
|
+
# parameter, which it then uses as part of its model call. <tt>#away</tt>
|
107
|
+
# does not, since it's simply a trigger action.
|
108
|
+
#
|
109
|
+
# Also note that in this example, <tt>current_user</tt> is available because
|
110
|
+
# it was marked as an identifying attribute on the connection. All such
|
111
|
+
# identifiers will automatically create a delegation method of the same name
|
112
|
+
# on the channel instance.
|
113
|
+
#
|
114
|
+
# == Rejecting subscription requests
|
115
|
+
#
|
116
|
+
# A channel can reject a subscription request in the #subscribed callback by
|
117
|
+
# invoking the #reject method:
|
118
|
+
#
|
119
|
+
# class ChatChannel < ApplicationCable::Channel
|
120
|
+
# def subscribed
|
121
|
+
# @room = Chat::Room[params[:room_number]]
|
122
|
+
# reject unless current_user.can_access?(@room)
|
123
|
+
# end
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# In this example, the subscription will be rejected if the
|
127
|
+
# <tt>current_user</tt> does not have access to the chat room. On the
|
128
|
+
# client-side, the <tt>Channel#rejected</tt> callback will get invoked when
|
129
|
+
# the server rejects the subscription request.
|
130
|
+
#
|
131
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:97
|
132
|
+
class ActionCable::Channel::Base
|
133
|
+
include ::ActiveSupport::Callbacks
|
134
|
+
include ::ActionCable::Channel::Callbacks
|
135
|
+
include ::ActionCable::Channel::PeriodicTimers
|
136
|
+
include ::ActionCable::Channel::Streams
|
137
|
+
include ::ActionCable::Channel::Naming
|
138
|
+
include ::ActionCable::Channel::Broadcasting
|
139
|
+
include ::ActiveSupport::Rescuable
|
140
|
+
extend ::ActiveSupport::Callbacks::ClassMethods
|
141
|
+
extend ::ActiveSupport::DescendantsTracker
|
142
|
+
extend ::ActionCable::Channel::Callbacks::ClassMethods
|
143
|
+
extend ::ActionCable::Channel::PeriodicTimers::ClassMethods
|
144
|
+
extend ::ActionCable::Channel::Naming::ClassMethods
|
145
|
+
extend ::ActionCable::Channel::Broadcasting::ClassMethods
|
146
|
+
extend ::ActiveSupport::Rescuable::ClassMethods
|
147
|
+
|
148
|
+
# @return [Base] a new instance of Base
|
149
|
+
#
|
150
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:144
|
151
|
+
def initialize(connection, identifier, params = T.unsafe(nil)); end
|
152
|
+
|
153
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
154
|
+
def __callbacks; end
|
155
|
+
|
156
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
157
|
+
def __callbacks?; end
|
158
|
+
|
159
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:928
|
160
|
+
def _run_subscribe_callbacks(&block); end
|
161
|
+
|
162
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:928
|
163
|
+
def _run_unsubscribe_callbacks(&block); end
|
164
|
+
|
165
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:940
|
166
|
+
def _subscribe_callbacks; end
|
167
|
+
|
168
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:940
|
169
|
+
def _unsubscribe_callbacks; end
|
170
|
+
|
171
|
+
# Returns the value of attribute connection.
|
172
|
+
#
|
173
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:105
|
174
|
+
def connection; end
|
175
|
+
|
176
|
+
# Returns the value of attribute identifier.
|
177
|
+
#
|
178
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:105
|
179
|
+
def identifier; end
|
180
|
+
|
181
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:106
|
182
|
+
def logger(*_arg0, &_arg1); end
|
183
|
+
|
184
|
+
# Returns the value of attribute params.
|
185
|
+
#
|
186
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:105
|
187
|
+
def params; end
|
188
|
+
|
189
|
+
# Extract the action name from the passed data and process it via the channel. The process will ensure
|
190
|
+
# that the action requested is a public method on the channel declared by the user (so not one of the callbacks
|
191
|
+
# like #subscribed).
|
192
|
+
#
|
193
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:164
|
194
|
+
def perform_action(data); end
|
195
|
+
|
196
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:9
|
197
|
+
def periodic_timers=(_arg0); end
|
198
|
+
|
199
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
200
|
+
def rescue_handlers; end
|
201
|
+
|
202
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
203
|
+
def rescue_handlers=(_arg0); end
|
204
|
+
|
205
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
206
|
+
def rescue_handlers?; end
|
207
|
+
|
208
|
+
# This method is called after subscription has been added to the connection
|
209
|
+
# and confirms or rejects the subscription.
|
210
|
+
#
|
211
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:179
|
212
|
+
def subscribe_to_channel; end
|
213
|
+
|
214
|
+
# Called by the cable connection when it's cut, so the channel has a chance to cleanup with callbacks.
|
215
|
+
# This method is not intended to be called directly by the user. Instead, override the #unsubscribed callback.
|
216
|
+
#
|
217
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:190
|
218
|
+
def unsubscribe_from_channel; end
|
219
|
+
|
220
|
+
private
|
221
|
+
|
222
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:276
|
223
|
+
def action_signature(action, data); end
|
224
|
+
|
225
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:228
|
226
|
+
def defer_subscription_confirmation!; end
|
227
|
+
|
228
|
+
# @return [Boolean]
|
229
|
+
#
|
230
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:232
|
231
|
+
def defer_subscription_confirmation?; end
|
232
|
+
|
233
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:248
|
234
|
+
def delegate_connection_identifiers; end
|
235
|
+
|
236
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:264
|
237
|
+
def dispatch_action(action, data); end
|
238
|
+
|
239
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:222
|
240
|
+
def ensure_confirmation_sent; end
|
241
|
+
|
242
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:256
|
243
|
+
def extract_action(data); end
|
244
|
+
|
245
|
+
# @return [Boolean]
|
246
|
+
#
|
247
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:260
|
248
|
+
def processable_action?(action); end
|
249
|
+
|
250
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:240
|
251
|
+
def reject; end
|
252
|
+
|
253
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:295
|
254
|
+
def reject_subscription; end
|
255
|
+
|
256
|
+
# Called once a consumer has become a subscriber of the channel. Usually the place to set up any streams
|
257
|
+
# you want this channel to be sending to the subscriber.
|
258
|
+
#
|
259
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:199
|
260
|
+
def subscribed; end
|
261
|
+
|
262
|
+
# @return [Boolean]
|
263
|
+
#
|
264
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:236
|
265
|
+
def subscription_confirmation_sent?; end
|
266
|
+
|
267
|
+
# @return [Boolean]
|
268
|
+
#
|
269
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:244
|
270
|
+
def subscription_rejected?; end
|
271
|
+
|
272
|
+
# Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with
|
273
|
+
# the proper channel identifier marked as the recipient.
|
274
|
+
#
|
275
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:211
|
276
|
+
def transmit(data, via: T.unsafe(nil)); end
|
277
|
+
|
278
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:284
|
279
|
+
def transmit_subscription_confirmation; end
|
280
|
+
|
281
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:300
|
282
|
+
def transmit_subscription_rejection; end
|
283
|
+
|
284
|
+
# Called once a consumer has cut its cable connection. Can be used for cleaning up connections or marking
|
285
|
+
# users as offline or the like.
|
286
|
+
#
|
287
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:205
|
288
|
+
def unsubscribed; end
|
289
|
+
|
290
|
+
class << self
|
291
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
292
|
+
def __callbacks; end
|
293
|
+
|
294
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
295
|
+
def __callbacks=(value); end
|
296
|
+
|
297
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
298
|
+
def __callbacks?; end
|
299
|
+
|
300
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:932
|
301
|
+
def _subscribe_callbacks; end
|
302
|
+
|
303
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:936
|
304
|
+
def _subscribe_callbacks=(value); end
|
305
|
+
|
306
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:932
|
307
|
+
def _unsubscribe_callbacks; end
|
308
|
+
|
309
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:936
|
310
|
+
def _unsubscribe_callbacks=(value); end
|
311
|
+
|
312
|
+
# A list of method names that should be considered actions. This
|
313
|
+
# includes all public instance methods on a channel, less
|
314
|
+
# any internal methods (defined on Base), adding back in
|
315
|
+
# any methods that are internal, but still exist on the class
|
316
|
+
# itself.
|
317
|
+
#
|
318
|
+
# ==== Returns
|
319
|
+
# * <tt>Set</tt> - A set of all methods that should be considered actions.
|
320
|
+
#
|
321
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:117
|
322
|
+
def action_methods; end
|
323
|
+
|
324
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:9
|
325
|
+
def periodic_timers; end
|
326
|
+
|
327
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:9
|
328
|
+
def periodic_timers=(value); end
|
329
|
+
|
330
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:9
|
331
|
+
def periodic_timers?; end
|
332
|
+
|
333
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
334
|
+
def rescue_handlers; end
|
335
|
+
|
336
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
337
|
+
def rescue_handlers=(value); end
|
338
|
+
|
339
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
340
|
+
def rescue_handlers?; end
|
341
|
+
|
342
|
+
private
|
343
|
+
|
344
|
+
# action_methods are cached and there is sometimes need to refresh
|
345
|
+
# them. ::clear_action_methods! allows you to do that, so next time
|
346
|
+
# you run action_methods, they will be recalculated.
|
347
|
+
#
|
348
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:133
|
349
|
+
def clear_action_methods!; end
|
350
|
+
|
351
|
+
# Refresh the cached action_methods when a new action_method is added.
|
352
|
+
#
|
353
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/base.rb:138
|
354
|
+
def method_added(name); end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:7
|
359
|
+
module ActionCable::Channel::Broadcasting
|
360
|
+
extend ::ActiveSupport::Concern
|
361
|
+
|
362
|
+
mixes_in_class_methods ::ActionCable::Channel::Broadcasting::ClassMethods
|
363
|
+
|
364
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:10
|
365
|
+
def broadcast_to(*_arg0, &_arg1); end
|
366
|
+
|
367
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:10
|
368
|
+
def broadcasting_for(*_arg0, &_arg1); end
|
369
|
+
end
|
370
|
+
|
371
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:12
|
372
|
+
module ActionCable::Channel::Broadcasting::ClassMethods
|
373
|
+
# Broadcast a hash to a unique broadcasting for this <tt>model</tt> in this channel.
|
374
|
+
#
|
375
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:14
|
376
|
+
def broadcast_to(model, message); end
|
377
|
+
|
378
|
+
# Returns a unique broadcasting identifier for this <tt>model</tt> in this channel:
|
379
|
+
#
|
380
|
+
# CommentsChannel.broadcasting_for("all") # => "comments:all"
|
381
|
+
#
|
382
|
+
# You can pass any object as a target (e.g. Active Record model), and it
|
383
|
+
# would be serialized into a string under the hood.
|
384
|
+
#
|
385
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:24
|
386
|
+
def broadcasting_for(model); end
|
387
|
+
|
388
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/broadcasting.rb:28
|
389
|
+
def serialize_broadcasting(object); end
|
390
|
+
end
|
391
|
+
|
392
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:7
|
393
|
+
module ActionCable::Channel::Callbacks
|
394
|
+
extend ::ActiveSupport::Concern
|
395
|
+
include GeneratedInstanceMethods
|
396
|
+
include ::ActiveSupport::Callbacks
|
397
|
+
|
398
|
+
mixes_in_class_methods GeneratedClassMethods
|
399
|
+
mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods
|
400
|
+
mixes_in_class_methods ::ActiveSupport::DescendantsTracker
|
401
|
+
mixes_in_class_methods ::ActionCable::Channel::Callbacks::ClassMethods
|
402
|
+
|
403
|
+
module GeneratedClassMethods
|
404
|
+
def __callbacks; end
|
405
|
+
def __callbacks=(value); end
|
406
|
+
def __callbacks?; end
|
407
|
+
end
|
408
|
+
|
409
|
+
module GeneratedInstanceMethods
|
410
|
+
def __callbacks; end
|
411
|
+
def __callbacks?; end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:16
|
416
|
+
module ActionCable::Channel::Callbacks::ClassMethods
|
417
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:21
|
418
|
+
def after_subscribe(*methods, &block); end
|
419
|
+
|
420
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:30
|
421
|
+
def after_unsubscribe(*methods, &block); end
|
422
|
+
|
423
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:17
|
424
|
+
def before_subscribe(*methods, &block); end
|
425
|
+
|
426
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:26
|
427
|
+
def before_unsubscribe(*methods, &block); end
|
428
|
+
|
429
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:21
|
430
|
+
def on_subscribe(*methods, &block); end
|
431
|
+
|
432
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/callbacks.rb:30
|
433
|
+
def on_unsubscribe(*methods, &block); end
|
434
|
+
end
|
435
|
+
|
436
|
+
# Stub +stream_from+ to track streams for the channel.
|
437
|
+
# Add public aliases for +subscription_confirmation_sent?+ and
|
438
|
+
# +subscription_rejected?+.
|
439
|
+
#
|
440
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:21
|
441
|
+
module ActionCable::Channel::ChannelStub
|
442
|
+
# @return [Boolean]
|
443
|
+
#
|
444
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:22
|
445
|
+
def confirmed?; end
|
446
|
+
|
447
|
+
# @return [Boolean]
|
448
|
+
#
|
449
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:26
|
450
|
+
def rejected?; end
|
451
|
+
|
452
|
+
# Make periodic timers no-op
|
453
|
+
#
|
454
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:43
|
455
|
+
def start_periodic_timers; end
|
456
|
+
|
457
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:34
|
458
|
+
def stop_all_streams; end
|
459
|
+
|
460
|
+
# Make periodic timers no-op
|
461
|
+
#
|
462
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:43
|
463
|
+
def stop_periodic_timers; end
|
464
|
+
|
465
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:30
|
466
|
+
def stream_from(broadcasting, *_arg1); end
|
467
|
+
|
468
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:38
|
469
|
+
def streams; end
|
470
|
+
end
|
471
|
+
|
472
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:47
|
473
|
+
class ActionCable::Channel::ConnectionStub
|
474
|
+
# @return [ConnectionStub] a new instance of ConnectionStub
|
475
|
+
#
|
476
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:50
|
477
|
+
def initialize(identifiers = T.unsafe(nil)); end
|
478
|
+
|
479
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:66
|
480
|
+
def connection_identifier; end
|
481
|
+
|
482
|
+
# Returns the value of attribute identifiers.
|
483
|
+
#
|
484
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:48
|
485
|
+
def identifiers; end
|
486
|
+
|
487
|
+
# Returns the value of attribute logger.
|
488
|
+
#
|
489
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:48
|
490
|
+
def logger; end
|
491
|
+
|
492
|
+
# Returns the value of attribute subscriptions.
|
493
|
+
#
|
494
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:48
|
495
|
+
def subscriptions; end
|
496
|
+
|
497
|
+
# Returns the value of attribute transmissions.
|
498
|
+
#
|
499
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:48
|
500
|
+
def transmissions; end
|
501
|
+
|
502
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:62
|
503
|
+
def transmit(cable_message); end
|
504
|
+
|
505
|
+
private
|
506
|
+
|
507
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:71
|
508
|
+
def connection_gid(ids); end
|
509
|
+
end
|
510
|
+
|
511
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/naming.rb:5
|
512
|
+
module ActionCable::Channel::Naming
|
513
|
+
extend ::ActiveSupport::Concern
|
514
|
+
|
515
|
+
mixes_in_class_methods ::ActionCable::Channel::Naming::ClassMethods
|
516
|
+
|
517
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/naming.rb:22
|
518
|
+
def channel_name(*_arg0, &_arg1); end
|
519
|
+
end
|
520
|
+
|
521
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/naming.rb:8
|
522
|
+
module ActionCable::Channel::Naming::ClassMethods
|
523
|
+
# Returns the name of the channel, underscored, without the <tt>Channel</tt> ending.
|
524
|
+
# If the channel is in a namespace, then the namespaces are represented by single
|
525
|
+
# colon separators in the channel name.
|
526
|
+
#
|
527
|
+
# ChatChannel.channel_name # => 'chat'
|
528
|
+
# Chats::AppearancesChannel.channel_name # => 'chats:appearances'
|
529
|
+
# FooChats::BarAppearancesChannel.channel_name # => 'foo_chats:bar_appearances'
|
530
|
+
#
|
531
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/naming.rb:16
|
532
|
+
def channel_name; end
|
533
|
+
end
|
534
|
+
|
535
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:10
|
536
|
+
class ActionCable::Channel::NonInferrableChannelError < ::StandardError
|
537
|
+
# @return [NonInferrableChannelError] a new instance of NonInferrableChannelError
|
538
|
+
#
|
539
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:11
|
540
|
+
def initialize(name); end
|
541
|
+
end
|
542
|
+
|
543
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:5
|
544
|
+
module ActionCable::Channel::PeriodicTimers
|
545
|
+
extend ::ActiveSupport::Concern
|
546
|
+
include GeneratedInstanceMethods
|
547
|
+
|
548
|
+
mixes_in_class_methods GeneratedClassMethods
|
549
|
+
mixes_in_class_methods ::ActionCable::Channel::PeriodicTimers::ClassMethods
|
550
|
+
|
551
|
+
private
|
552
|
+
|
553
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:56
|
554
|
+
def active_periodic_timers; end
|
555
|
+
|
556
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:66
|
557
|
+
def start_periodic_timer(callback, every:); end
|
558
|
+
|
559
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:60
|
560
|
+
def start_periodic_timers; end
|
561
|
+
|
562
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:72
|
563
|
+
def stop_periodic_timers; end
|
564
|
+
|
565
|
+
module GeneratedClassMethods
|
566
|
+
def periodic_timers; end
|
567
|
+
def periodic_timers=(value); end
|
568
|
+
def periodic_timers?; end
|
569
|
+
end
|
570
|
+
|
571
|
+
module GeneratedInstanceMethods
|
572
|
+
def periodic_timers=(value); end
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:15
|
577
|
+
module ActionCable::Channel::PeriodicTimers::ClassMethods
|
578
|
+
# Periodically performs a task on the channel, like updating an online
|
579
|
+
# user counter, polling a backend for new status messages, sending
|
580
|
+
# regular "heartbeat" messages, or doing some internal work and giving
|
581
|
+
# progress updates.
|
582
|
+
#
|
583
|
+
# Pass a method name or lambda argument or provide a block to call.
|
584
|
+
# Specify the calling period in seconds using the <tt>every:</tt>
|
585
|
+
# keyword argument.
|
586
|
+
#
|
587
|
+
# periodically :transmit_progress, every: 5.seconds
|
588
|
+
#
|
589
|
+
# periodically every: 3.minutes do
|
590
|
+
# transmit action: :update_count, count: current_count
|
591
|
+
# end
|
592
|
+
#
|
593
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/periodic_timers.rb:31
|
594
|
+
def periodically(callback_or_method_name = T.unsafe(nil), every:, &block); end
|
595
|
+
end
|
596
|
+
|
597
|
+
# Streams allow channels to route broadcastings to the subscriber. A broadcasting is, as discussed elsewhere, a pubsub queue where any data
|
598
|
+
# placed into it is automatically sent to the clients that are connected at that time. It's purely an online queue, though. If you're not
|
599
|
+
# streaming a broadcasting at the very moment it sends out an update, you will not get that update, even if you connect after it has been sent.
|
600
|
+
#
|
601
|
+
# Most commonly, the streamed broadcast is sent straight to the subscriber on the client-side. The channel just acts as a connector between
|
602
|
+
# the two parties (the broadcaster and the channel subscriber). Here's an example of a channel that allows subscribers to get all new
|
603
|
+
# comments on a given page:
|
604
|
+
#
|
605
|
+
# class CommentsChannel < ApplicationCable::Channel
|
606
|
+
# def follow(data)
|
607
|
+
# stream_from "comments_for_#{data['recording_id']}"
|
608
|
+
# end
|
609
|
+
#
|
610
|
+
# def unfollow
|
611
|
+
# stop_all_streams
|
612
|
+
# end
|
613
|
+
# end
|
614
|
+
#
|
615
|
+
# Based on the above example, the subscribers of this channel will get whatever data is put into the,
|
616
|
+
# let's say, <tt>comments_for_45</tt> broadcasting as soon as it's put there.
|
617
|
+
#
|
618
|
+
# An example broadcasting for this channel looks like so:
|
619
|
+
#
|
620
|
+
# ActionCable.server.broadcast "comments_for_45", { author: 'DHH', content: 'Rails is just swell' }
|
621
|
+
#
|
622
|
+
# If you have a stream that is related to a model, then the broadcasting used can be generated from the model and channel.
|
623
|
+
# The following example would subscribe to a broadcasting like <tt>comments:Z2lkOi8vVGVzdEFwcC9Qb3N0LzE</tt>.
|
624
|
+
#
|
625
|
+
# class CommentsChannel < ApplicationCable::Channel
|
626
|
+
# def subscribed
|
627
|
+
# post = Post.find(params[:id])
|
628
|
+
# stream_for post
|
629
|
+
# end
|
630
|
+
# end
|
631
|
+
#
|
632
|
+
# You can then broadcast to this channel using:
|
633
|
+
#
|
634
|
+
# CommentsChannel.broadcast_to(@post, @comment)
|
635
|
+
#
|
636
|
+
# If you don't just want to parlay the broadcast unfiltered to the subscriber, you can also supply a callback that lets you alter what is sent out.
|
637
|
+
# The below example shows how you can use this to provide performance introspection in the process:
|
638
|
+
#
|
639
|
+
# class ChatChannel < ApplicationCable::Channel
|
640
|
+
# def subscribed
|
641
|
+
# @room = Chat::Room[params[:room_number]]
|
642
|
+
#
|
643
|
+
# stream_for @room, coder: ActiveSupport::JSON do |message|
|
644
|
+
# if message['originated_at'].present?
|
645
|
+
# elapsed_time = (Time.now.to_f - message['originated_at']).round(2)
|
646
|
+
#
|
647
|
+
# ActiveSupport::Notifications.instrument :performance, measurement: 'Chat.message_delay', value: elapsed_time, action: :timing
|
648
|
+
# logger.info "Message took #{elapsed_time}s to arrive"
|
649
|
+
# end
|
650
|
+
#
|
651
|
+
# transmit message
|
652
|
+
# end
|
653
|
+
# end
|
654
|
+
# end
|
655
|
+
#
|
656
|
+
# You can stop streaming from all broadcasts by calling #stop_all_streams.
|
657
|
+
#
|
658
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:65
|
659
|
+
module ActionCable::Channel::Streams
|
660
|
+
extend ::ActiveSupport::Concern
|
661
|
+
|
662
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:138
|
663
|
+
def pubsub(*_arg0, &_arg1); end
|
664
|
+
|
665
|
+
# Unsubscribes all streams associated with this channel from the pubsub queue.
|
666
|
+
#
|
667
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:120
|
668
|
+
def stop_all_streams; end
|
669
|
+
|
670
|
+
# Unsubscribes streams for the <tt>model</tt>.
|
671
|
+
#
|
672
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:115
|
673
|
+
def stop_stream_for(model); end
|
674
|
+
|
675
|
+
# Unsubscribes streams from the named <tt>broadcasting</tt>.
|
676
|
+
#
|
677
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:106
|
678
|
+
def stop_stream_from(broadcasting); end
|
679
|
+
|
680
|
+
# Start streaming the pubsub queue for the <tt>model</tt> in this channel. Optionally, you can pass a
|
681
|
+
# <tt>callback</tt> that'll be used instead of the default of just transmitting the updates straight
|
682
|
+
# to the subscriber.
|
683
|
+
#
|
684
|
+
# Pass <tt>coder: ActiveSupport::JSON</tt> to decode messages as JSON before passing to the callback.
|
685
|
+
# Defaults to <tt>coder: nil</tt> which does no decoding, passes raw messages.
|
686
|
+
#
|
687
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:101
|
688
|
+
def stream_for(model, callback = T.unsafe(nil), coder: T.unsafe(nil), &block); end
|
689
|
+
|
690
|
+
# Start streaming from the named <tt>broadcasting</tt> pubsub queue. Optionally, you can pass a <tt>callback</tt> that'll be used
|
691
|
+
# instead of the default of just transmitting the updates straight to the subscriber.
|
692
|
+
# Pass <tt>coder: ActiveSupport::JSON</tt> to decode messages as JSON before passing to the callback.
|
693
|
+
# Defaults to <tt>coder: nil</tt> which does no decoding, passes raw messages.
|
694
|
+
#
|
695
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:76
|
696
|
+
def stream_from(broadcasting, callback = T.unsafe(nil), coder: T.unsafe(nil), &block); end
|
697
|
+
|
698
|
+
# Calls stream_for with the given <tt>model</tt> if it's present to start streaming,
|
699
|
+
# otherwise rejects the subscription.
|
700
|
+
#
|
701
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:129
|
702
|
+
def stream_or_reject_for(model); end
|
703
|
+
|
704
|
+
private
|
705
|
+
|
706
|
+
# May be overridden to change the default stream handling behavior
|
707
|
+
# which decodes JSON and transmits to the client.
|
708
|
+
#
|
709
|
+
# TODO: Tests demonstrating this.
|
710
|
+
#
|
711
|
+
# TODO: Room for optimization. Update transmit API to be coder-aware
|
712
|
+
# so we can no-op when pubsub and connection are both JSON-encoded.
|
713
|
+
# Then we can skip decode+encode if we're just proxying messages.
|
714
|
+
#
|
715
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:174
|
716
|
+
def default_stream_handler(broadcasting, coder:); end
|
717
|
+
|
718
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:195
|
719
|
+
def identity_handler; end
|
720
|
+
|
721
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:179
|
722
|
+
def stream_decoder(handler = T.unsafe(nil), coder:); end
|
723
|
+
|
724
|
+
# May be overridden to add instrumentation, logging, specialized error
|
725
|
+
# handling, or other forms of handler decoration.
|
726
|
+
#
|
727
|
+
# TODO: Tests demonstrating this.
|
728
|
+
#
|
729
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:158
|
730
|
+
def stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end
|
731
|
+
|
732
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:187
|
733
|
+
def stream_transmitter(handler = T.unsafe(nil), broadcasting:); end
|
734
|
+
|
735
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:140
|
736
|
+
def streams; end
|
737
|
+
|
738
|
+
# Always wrap the outermost handler to invoke the user handler on the
|
739
|
+
# worker pool rather than blocking the event loop.
|
740
|
+
#
|
741
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/streams.rb:146
|
742
|
+
def worker_pool_stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end
|
743
|
+
end
|
744
|
+
|
745
|
+
# Superclass for Action Cable channel functional tests.
|
746
|
+
#
|
747
|
+
# == Basic example
|
748
|
+
#
|
749
|
+
# Functional tests are written as follows:
|
750
|
+
# 1. First, one uses the +subscribe+ method to simulate subscription creation.
|
751
|
+
# 2. Then, one asserts whether the current state is as expected. "State" can be anything:
|
752
|
+
# transmitted messages, subscribed streams, etc.
|
753
|
+
#
|
754
|
+
# For example:
|
755
|
+
#
|
756
|
+
# class ChatChannelTest < ActionCable::Channel::TestCase
|
757
|
+
# def test_subscribed_with_room_number
|
758
|
+
# # Simulate a subscription creation
|
759
|
+
# subscribe room_number: 1
|
760
|
+
#
|
761
|
+
# # Asserts that the subscription was successfully created
|
762
|
+
# assert subscription.confirmed?
|
763
|
+
#
|
764
|
+
# # Asserts that the channel subscribes connection to a stream
|
765
|
+
# assert_has_stream "chat_1"
|
766
|
+
#
|
767
|
+
# # Asserts that the channel subscribes connection to a specific
|
768
|
+
# # stream created for a model
|
769
|
+
# assert_has_stream_for Room.find(1)
|
770
|
+
# end
|
771
|
+
#
|
772
|
+
# def test_does_not_stream_with_incorrect_room_number
|
773
|
+
# subscribe room_number: -1
|
774
|
+
#
|
775
|
+
# # Asserts that not streams was started
|
776
|
+
# assert_no_streams
|
777
|
+
# end
|
778
|
+
#
|
779
|
+
# def test_does_not_subscribe_without_room_number
|
780
|
+
# subscribe
|
781
|
+
#
|
782
|
+
# # Asserts that the subscription was rejected
|
783
|
+
# assert subscription.rejected?
|
784
|
+
# end
|
785
|
+
# end
|
786
|
+
#
|
787
|
+
# You can also perform actions:
|
788
|
+
# def test_perform_speak
|
789
|
+
# subscribe room_number: 1
|
790
|
+
#
|
791
|
+
# perform :speak, message: "Hello, Rails!"
|
792
|
+
#
|
793
|
+
# assert_equal "Hello, Rails!", transmissions.last["text"]
|
794
|
+
# end
|
795
|
+
#
|
796
|
+
# == Special methods
|
797
|
+
#
|
798
|
+
# ActionCable::Channel::TestCase will also automatically provide the following instance
|
799
|
+
# methods for use in the tests:
|
800
|
+
#
|
801
|
+
# <b>connection</b>::
|
802
|
+
# An ActionCable::Channel::ConnectionStub, representing the current HTTP connection.
|
803
|
+
# <b>subscription</b>::
|
804
|
+
# An instance of the current channel, created when you call +subscribe+.
|
805
|
+
# <b>transmissions</b>::
|
806
|
+
# A list of all messages that have been transmitted into the channel.
|
807
|
+
#
|
808
|
+
#
|
809
|
+
# == Channel is automatically inferred
|
810
|
+
#
|
811
|
+
# ActionCable::Channel::TestCase will automatically infer the channel under test
|
812
|
+
# from the test class name. If the channel cannot be inferred from the test
|
813
|
+
# class name, you can explicitly set it with +tests+.
|
814
|
+
#
|
815
|
+
# class SpecialEdgeCaseChannelTest < ActionCable::Channel::TestCase
|
816
|
+
# tests SpecialChannel
|
817
|
+
# end
|
818
|
+
#
|
819
|
+
# == Specifying connection identifiers
|
820
|
+
#
|
821
|
+
# You need to set up your connection manually to provide values for the identifiers.
|
822
|
+
# To do this just use:
|
823
|
+
#
|
824
|
+
# stub_connection(user: users(:john))
|
825
|
+
#
|
826
|
+
# == Testing broadcasting
|
827
|
+
#
|
828
|
+
# ActionCable::Channel::TestCase enhances ActionCable::TestHelper assertions (e.g.
|
829
|
+
# +assert_broadcasts+) to handle broadcasting to models:
|
830
|
+
#
|
831
|
+
#
|
832
|
+
# # in your channel
|
833
|
+
# def speak(data)
|
834
|
+
# broadcast_to room, text: data["message"]
|
835
|
+
# end
|
836
|
+
#
|
837
|
+
# def test_speak
|
838
|
+
# subscribe room_id: rooms(:chat).id
|
839
|
+
#
|
840
|
+
# assert_broadcast_on(rooms(:chat), text: "Hello, Rails!") do
|
841
|
+
# perform :speak, message: "Hello, Rails!"
|
842
|
+
# end
|
843
|
+
# end
|
844
|
+
#
|
845
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:181
|
846
|
+
class ActionCable::Channel::TestCase < ::ActiveSupport::TestCase
|
847
|
+
include ::ActiveSupport::Testing::ConstantLookup
|
848
|
+
include ::ActionCable::TestHelper
|
849
|
+
include ::ActionCable::Channel::TestCase::Behavior
|
850
|
+
extend ::ActiveSupport::Testing::ConstantLookup::ClassMethods
|
851
|
+
extend ::ActionCable::Channel::TestCase::Behavior::ClassMethods
|
852
|
+
|
853
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
854
|
+
def _channel_class; end
|
855
|
+
|
856
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
857
|
+
def _channel_class=(_arg0); end
|
858
|
+
|
859
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
860
|
+
def _channel_class?; end
|
861
|
+
|
862
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:193
|
863
|
+
def connection; end
|
864
|
+
|
865
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:193
|
866
|
+
def subscription; end
|
867
|
+
|
868
|
+
class << self
|
869
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
870
|
+
def _channel_class; end
|
871
|
+
|
872
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
873
|
+
def _channel_class=(value); end
|
874
|
+
|
875
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:191
|
876
|
+
def _channel_class?; end
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
880
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:182
|
881
|
+
module ActionCable::Channel::TestCase::Behavior
|
882
|
+
include ::ActionCable::TestHelper
|
883
|
+
extend ::ActiveSupport::Concern
|
884
|
+
include GeneratedInstanceMethods
|
885
|
+
include ::ActiveSupport::Testing::ConstantLookup
|
886
|
+
|
887
|
+
mixes_in_class_methods GeneratedClassMethods
|
888
|
+
mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods
|
889
|
+
mixes_in_class_methods ::ActionCable::Channel::TestCase::Behavior::ClassMethods
|
890
|
+
|
891
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:273
|
892
|
+
def assert_broadcast_on(stream_or_object, *args); end
|
893
|
+
|
894
|
+
# Enhance TestHelper assertions to handle non-String
|
895
|
+
# broadcastings
|
896
|
+
#
|
897
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:269
|
898
|
+
def assert_broadcasts(stream_or_object, *args); end
|
899
|
+
|
900
|
+
# Asserts that the specified stream has been started.
|
901
|
+
#
|
902
|
+
# def test_assert_started_stream
|
903
|
+
# subscribe
|
904
|
+
# assert_has_stream 'messages'
|
905
|
+
# end
|
906
|
+
#
|
907
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:295
|
908
|
+
def assert_has_stream(stream); end
|
909
|
+
|
910
|
+
# Asserts that the specified stream for a model has started.
|
911
|
+
#
|
912
|
+
# def test_assert_started_stream_for
|
913
|
+
# subscribe id: 42
|
914
|
+
# assert_has_stream_for User.find(42)
|
915
|
+
# end
|
916
|
+
#
|
917
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:306
|
918
|
+
def assert_has_stream_for(object); end
|
919
|
+
|
920
|
+
# Asserts that no streams have been started.
|
921
|
+
#
|
922
|
+
# def test_assert_no_started_stream
|
923
|
+
# subscribe
|
924
|
+
# assert_no_streams
|
925
|
+
# end
|
926
|
+
#
|
927
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:284
|
928
|
+
def assert_no_streams; end
|
929
|
+
|
930
|
+
# Perform action on a channel.
|
931
|
+
#
|
932
|
+
# NOTE: Must be subscribed.
|
933
|
+
#
|
934
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:256
|
935
|
+
def perform(action, data = T.unsafe(nil)); end
|
936
|
+
|
937
|
+
# Set up test connection with the specified identifiers:
|
938
|
+
#
|
939
|
+
# class ApplicationCable < ActionCable::Connection::Base
|
940
|
+
# identified_by :user, :token
|
941
|
+
# end
|
942
|
+
#
|
943
|
+
# stub_connection(user: users[:john], token: 'my-secret-token')
|
944
|
+
#
|
945
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:234
|
946
|
+
def stub_connection(identifiers = T.unsafe(nil)); end
|
947
|
+
|
948
|
+
# Subscribe to the channel under test. Optionally pass subscription parameters as a Hash.
|
949
|
+
#
|
950
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:239
|
951
|
+
def subscribe(params = T.unsafe(nil)); end
|
952
|
+
|
953
|
+
# Returns messages transmitted into channel
|
954
|
+
#
|
955
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:262
|
956
|
+
def transmissions; end
|
957
|
+
|
958
|
+
# Unsubscribe the subscription under test.
|
959
|
+
#
|
960
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:248
|
961
|
+
def unsubscribe; end
|
962
|
+
|
963
|
+
private
|
964
|
+
|
965
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:315
|
966
|
+
def broadcasting_for(stream_or_object); end
|
967
|
+
|
968
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:311
|
969
|
+
def check_subscribed!; end
|
970
|
+
|
971
|
+
module GeneratedClassMethods
|
972
|
+
def _channel_class; end
|
973
|
+
def _channel_class=(value); end
|
974
|
+
def _channel_class?; end
|
975
|
+
end
|
976
|
+
|
977
|
+
module GeneratedInstanceMethods
|
978
|
+
def _channel_class; end
|
979
|
+
def _channel_class=(value); end
|
980
|
+
def _channel_class?; end
|
981
|
+
end
|
982
|
+
end
|
983
|
+
|
984
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:188
|
985
|
+
ActionCable::Channel::TestCase::Behavior::CHANNEL_IDENTIFIER = T.let(T.unsafe(nil), String)
|
986
|
+
|
987
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:198
|
988
|
+
module ActionCable::Channel::TestCase::Behavior::ClassMethods
|
989
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:210
|
990
|
+
def channel_class; end
|
991
|
+
|
992
|
+
# @raise [NonInferrableChannelError]
|
993
|
+
#
|
994
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:218
|
995
|
+
def determine_default_channel(name); end
|
996
|
+
|
997
|
+
# source://actioncable-7.0.3.1/lib/action_cable/channel/test_case.rb:199
|
998
|
+
def tests(channel); end
|
999
|
+
end
|
1000
|
+
|
1001
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection.rb:4
|
1002
|
+
module ActionCable::Connection
|
1003
|
+
extend ::ActiveSupport::Autoload
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:20
|
1007
|
+
module ActionCable::Connection::Assertions
|
1008
|
+
# Asserts that the connection is rejected (via +reject_unauthorized_connection+).
|
1009
|
+
#
|
1010
|
+
# # Asserts that connection without user_id fails
|
1011
|
+
# assert_reject_connection { connect params: { user_id: '' } }
|
1012
|
+
#
|
1013
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:25
|
1014
|
+
def assert_reject_connection(&block); end
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/authorization.rb:5
|
1018
|
+
module ActionCable::Connection::Authorization
|
1019
|
+
# Closes the WebSocket connection if it is open and returns a 404 "File not Found" response.
|
1020
|
+
#
|
1021
|
+
# @raise [UnauthorizedError]
|
1022
|
+
#
|
1023
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/authorization.rb:9
|
1024
|
+
def reject_unauthorized_connection; end
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/authorization.rb:6
|
1028
|
+
class ActionCable::Connection::Authorization::UnauthorizedError < ::StandardError; end
|
1029
|
+
|
1030
|
+
# For every WebSocket connection the Action Cable server accepts, a Connection object will be instantiated. This instance becomes the parent
|
1031
|
+
# of all of the channel subscriptions that are created from there on. Incoming messages are then routed to these channel subscriptions
|
1032
|
+
# based on an identifier sent by the Action Cable consumer. The Connection itself does not deal with any specific application logic beyond
|
1033
|
+
# authentication and authorization.
|
1034
|
+
#
|
1035
|
+
# Here's a basic example:
|
1036
|
+
#
|
1037
|
+
# module ApplicationCable
|
1038
|
+
# class Connection < ActionCable::Connection::Base
|
1039
|
+
# identified_by :current_user
|
1040
|
+
#
|
1041
|
+
# def connect
|
1042
|
+
# self.current_user = find_verified_user
|
1043
|
+
# logger.add_tags current_user.name
|
1044
|
+
# end
|
1045
|
+
#
|
1046
|
+
# def disconnect
|
1047
|
+
# # Any cleanup work needed when the cable connection is cut.
|
1048
|
+
# end
|
1049
|
+
#
|
1050
|
+
# private
|
1051
|
+
# def find_verified_user
|
1052
|
+
# User.find_by_identity(cookies.encrypted[:identity_id]) ||
|
1053
|
+
# reject_unauthorized_connection
|
1054
|
+
# end
|
1055
|
+
# end
|
1056
|
+
# end
|
1057
|
+
#
|
1058
|
+
# First, we declare that this connection can be identified by its current_user. This allows us to later be able to find all connections
|
1059
|
+
# established for that current_user (and potentially disconnect them). You can declare as many
|
1060
|
+
# identification indexes as you like. Declaring an identification means that an attr_accessor is automatically set for that key.
|
1061
|
+
#
|
1062
|
+
# Second, we rely on the fact that the WebSocket connection is established with the cookies from the domain being sent along. This makes
|
1063
|
+
# it easy to use signed cookies that were set when logging in via a web interface to authorize the WebSocket connection.
|
1064
|
+
#
|
1065
|
+
# Finally, we add a tag to the connection-specific logger with the name of the current user to easily distinguish their messages in the log.
|
1066
|
+
#
|
1067
|
+
# Pretty simple, eh?
|
1068
|
+
#
|
1069
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:46
|
1070
|
+
class ActionCable::Connection::Base
|
1071
|
+
include ::ActionCable::Connection::Identification
|
1072
|
+
include ::ActionCable::Connection::InternalChannel
|
1073
|
+
include ::ActionCable::Connection::Authorization
|
1074
|
+
include ::ActiveSupport::Rescuable
|
1075
|
+
extend ::ActionCable::Connection::Identification::ClassMethods
|
1076
|
+
extend ::ActiveSupport::Rescuable::ClassMethods
|
1077
|
+
|
1078
|
+
# @return [Base] a new instance of Base
|
1079
|
+
#
|
1080
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:55
|
1081
|
+
def initialize(server, env, coder: T.unsafe(nil)); end
|
1082
|
+
|
1083
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:125
|
1084
|
+
def beat; end
|
1085
|
+
|
1086
|
+
# Close the WebSocket connection.
|
1087
|
+
#
|
1088
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:100
|
1089
|
+
def close(reason: T.unsafe(nil), reconnect: T.unsafe(nil)); end
|
1090
|
+
|
1091
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:87
|
1092
|
+
def dispatch_websocket_message(websocket_message); end
|
1093
|
+
|
1094
|
+
# Returns the value of attribute env.
|
1095
|
+
#
|
1096
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1097
|
+
def env; end
|
1098
|
+
|
1099
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:53
|
1100
|
+
def event_loop(*_arg0, &_arg1); end
|
1101
|
+
|
1102
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1103
|
+
def identifiers; end
|
1104
|
+
|
1105
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1106
|
+
def identifiers=(_arg0); end
|
1107
|
+
|
1108
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1109
|
+
def identifiers?; end
|
1110
|
+
|
1111
|
+
# Returns the value of attribute logger.
|
1112
|
+
#
|
1113
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1114
|
+
def logger; end
|
1115
|
+
|
1116
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:142
|
1117
|
+
def on_close(reason, code); end
|
1118
|
+
|
1119
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:137
|
1120
|
+
def on_error(message); end
|
1121
|
+
|
1122
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:133
|
1123
|
+
def on_message(message); end
|
1124
|
+
|
1125
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:129
|
1126
|
+
def on_open; end
|
1127
|
+
|
1128
|
+
# Called by the server when a new WebSocket connection is established. This configures the callbacks intended for overwriting by the user.
|
1129
|
+
# This method should not be called directly -- instead rely upon on the #connect (and #disconnect) callbacks.
|
1130
|
+
#
|
1131
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:71
|
1132
|
+
def process; end
|
1133
|
+
|
1134
|
+
# Returns the value of attribute protocol.
|
1135
|
+
#
|
1136
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1137
|
+
def protocol; end
|
1138
|
+
|
1139
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:53
|
1140
|
+
def pubsub(*_arg0, &_arg1); end
|
1141
|
+
|
1142
|
+
# Decodes WebSocket messages and dispatches them to subscribed channels.
|
1143
|
+
# WebSocket message transfer encoding is always JSON.
|
1144
|
+
#
|
1145
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:83
|
1146
|
+
def receive(websocket_message); end
|
1147
|
+
|
1148
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1149
|
+
def rescue_handlers; end
|
1150
|
+
|
1151
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1152
|
+
def rescue_handlers=(_arg0); end
|
1153
|
+
|
1154
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1155
|
+
def rescue_handlers?; end
|
1156
|
+
|
1157
|
+
# Invoke a method on the connection asynchronously through the pool of thread workers.
|
1158
|
+
#
|
1159
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:110
|
1160
|
+
def send_async(method, *arguments); end
|
1161
|
+
|
1162
|
+
# Returns the value of attribute server.
|
1163
|
+
#
|
1164
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1165
|
+
def server; end
|
1166
|
+
|
1167
|
+
# Return a basic hash of statistics for the connection keyed with <tt>identifier</tt>, <tt>started_at</tt>, <tt>subscriptions</tt>, and <tt>request_id</tt>.
|
1168
|
+
# This can be returned by a health check against the connection.
|
1169
|
+
#
|
1170
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:116
|
1171
|
+
def statistics; end
|
1172
|
+
|
1173
|
+
# Returns the value of attribute subscriptions.
|
1174
|
+
#
|
1175
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1176
|
+
def subscriptions; end
|
1177
|
+
|
1178
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:95
|
1179
|
+
def transmit(cable_message); end
|
1180
|
+
|
1181
|
+
# Returns the value of attribute worker_pool.
|
1182
|
+
#
|
1183
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:52
|
1184
|
+
def worker_pool; end
|
1185
|
+
|
1186
|
+
private
|
1187
|
+
|
1188
|
+
# @return [Boolean]
|
1189
|
+
#
|
1190
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:201
|
1191
|
+
def allow_request_origin?; end
|
1192
|
+
|
1193
|
+
# The cookies of the request that initiated the WebSocket connection. Useful for performing authorization checks.
|
1194
|
+
#
|
1195
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:159
|
1196
|
+
def cookies; end
|
1197
|
+
|
1198
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:167
|
1199
|
+
def decode(websocket_message); end
|
1200
|
+
|
1201
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:163
|
1202
|
+
def encode(cable_message); end
|
1203
|
+
|
1204
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:243
|
1205
|
+
def finished_request_message; end
|
1206
|
+
|
1207
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:183
|
1208
|
+
def handle_close; end
|
1209
|
+
|
1210
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:171
|
1211
|
+
def handle_open; end
|
1212
|
+
|
1213
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:251
|
1214
|
+
def invalid_request_message; end
|
1215
|
+
|
1216
|
+
# Returns the value of attribute message_buffer.
|
1217
|
+
#
|
1218
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:148
|
1219
|
+
def message_buffer; end
|
1220
|
+
|
1221
|
+
# Tags are declared in the server but computed in the connection. This allows us per-connection tailored tags.
|
1222
|
+
#
|
1223
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:229
|
1224
|
+
def new_tagged_logger; end
|
1225
|
+
|
1226
|
+
# The request that initiated the WebSocket connection is available here. This gives access to the environment, cookies, etc.
|
1227
|
+
#
|
1228
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:151
|
1229
|
+
def request; end
|
1230
|
+
|
1231
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:220
|
1232
|
+
def respond_to_invalid_request; end
|
1233
|
+
|
1234
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:215
|
1235
|
+
def respond_to_successful_request; end
|
1236
|
+
|
1237
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:194
|
1238
|
+
def send_welcome_message; end
|
1239
|
+
|
1240
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:234
|
1241
|
+
def started_request_message; end
|
1242
|
+
|
1243
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:257
|
1244
|
+
def successful_request_message; end
|
1245
|
+
|
1246
|
+
# Returns the value of attribute websocket.
|
1247
|
+
#
|
1248
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/base.rb:147
|
1249
|
+
def websocket; end
|
1250
|
+
|
1251
|
+
class << self
|
1252
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1253
|
+
def identifiers; end
|
1254
|
+
|
1255
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1256
|
+
def identifiers=(value); end
|
1257
|
+
|
1258
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
1259
|
+
def identifiers?; end
|
1260
|
+
|
1261
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1262
|
+
def rescue_handlers; end
|
1263
|
+
|
1264
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1265
|
+
def rescue_handlers=(value); end
|
1266
|
+
|
1267
|
+
# source://activesupport-7.0.3.1/lib/active_support/rescuable.rb:13
|
1268
|
+
def rescue_handlers?; end
|
1269
|
+
end
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:11
|
1273
|
+
class ActionCable::Connection::ClientSocket
|
1274
|
+
# @return [ClientSocket] a new instance of ClientSocket
|
1275
|
+
#
|
1276
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:34
|
1277
|
+
def initialize(env, event_target, event_loop, protocols); end
|
1278
|
+
|
1279
|
+
# @return [Boolean]
|
1280
|
+
#
|
1281
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:112
|
1282
|
+
def alive?; end
|
1283
|
+
|
1284
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:108
|
1285
|
+
def client_gone; end
|
1286
|
+
|
1287
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:90
|
1288
|
+
def close(code = T.unsafe(nil), reason = T.unsafe(nil)); end
|
1289
|
+
|
1290
|
+
# Returns the value of attribute env.
|
1291
|
+
#
|
1292
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:32
|
1293
|
+
def env; end
|
1294
|
+
|
1295
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:104
|
1296
|
+
def parse(data); end
|
1297
|
+
|
1298
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:116
|
1299
|
+
def protocol; end
|
1300
|
+
|
1301
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:69
|
1302
|
+
def rack_response; end
|
1303
|
+
|
1304
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:57
|
1305
|
+
def start_driver; end
|
1306
|
+
|
1307
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:80
|
1308
|
+
def transmit(message); end
|
1309
|
+
|
1310
|
+
# Returns the value of attribute url.
|
1311
|
+
#
|
1312
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:32
|
1313
|
+
def url; end
|
1314
|
+
|
1315
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:74
|
1316
|
+
def write(data); end
|
1317
|
+
|
1318
|
+
private
|
1319
|
+
|
1320
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:140
|
1321
|
+
def begin_close(reason, code); end
|
1322
|
+
|
1323
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:134
|
1324
|
+
def emit_error(message); end
|
1325
|
+
|
1326
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:149
|
1327
|
+
def finalize_close; end
|
1328
|
+
|
1329
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:121
|
1330
|
+
def open; end
|
1331
|
+
|
1332
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:128
|
1333
|
+
def receive_message(data); end
|
1334
|
+
|
1335
|
+
class << self
|
1336
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:12
|
1337
|
+
def determine_url(env); end
|
1338
|
+
|
1339
|
+
# @return [Boolean]
|
1340
|
+
#
|
1341
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:17
|
1342
|
+
def secure_request?(env); end
|
1343
|
+
end
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:30
|
1347
|
+
ActionCable::Connection::ClientSocket::CLOSED = T.let(T.unsafe(nil), Integer)
|
1348
|
+
|
1349
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:29
|
1350
|
+
ActionCable::Connection::ClientSocket::CLOSING = T.let(T.unsafe(nil), Integer)
|
1351
|
+
|
1352
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:27
|
1353
|
+
ActionCable::Connection::ClientSocket::CONNECTING = T.let(T.unsafe(nil), Integer)
|
1354
|
+
|
1355
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/client_socket.rb:28
|
1356
|
+
ActionCable::Connection::ClientSocket::OPEN = T.let(T.unsafe(nil), Integer)
|
1357
|
+
|
1358
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:7
|
1359
|
+
module ActionCable::Connection::Identification
|
1360
|
+
extend ::ActiveSupport::Concern
|
1361
|
+
include GeneratedInstanceMethods
|
1362
|
+
|
1363
|
+
mixes_in_class_methods GeneratedClassMethods
|
1364
|
+
mixes_in_class_methods ::ActionCable::Connection::Identification::ClassMethods
|
1365
|
+
|
1366
|
+
# Return a single connection identifier that combines the value of all the registered identifiers into a single gid.
|
1367
|
+
#
|
1368
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:27
|
1369
|
+
def connection_identifier; end
|
1370
|
+
|
1371
|
+
private
|
1372
|
+
|
1373
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:36
|
1374
|
+
def connection_gid(ids); end
|
1375
|
+
|
1376
|
+
module GeneratedClassMethods
|
1377
|
+
def identifiers; end
|
1378
|
+
def identifiers=(value); end
|
1379
|
+
def identifiers?; end
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
module GeneratedInstanceMethods
|
1383
|
+
def identifiers; end
|
1384
|
+
def identifiers=(value); end
|
1385
|
+
def identifiers?; end
|
1386
|
+
end
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:14
|
1390
|
+
module ActionCable::Connection::Identification::ClassMethods
|
1391
|
+
# Mark a key as being a connection identifier index that can then be used to find the specific connection again later.
|
1392
|
+
# Common identifiers are current_user and current_account, but could be anything, really.
|
1393
|
+
#
|
1394
|
+
# Note that anything marked as an identifier will automatically create a delegate by the same name on any
|
1395
|
+
# channel instances created off the connection.
|
1396
|
+
#
|
1397
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:20
|
1398
|
+
def identified_by(*identifiers); end
|
1399
|
+
end
|
1400
|
+
|
1401
|
+
# Makes it possible for the RemoteConnection to disconnect a specific connection.
|
1402
|
+
#
|
1403
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/internal_channel.rb:6
|
1404
|
+
module ActionCable::Connection::InternalChannel
|
1405
|
+
extend ::ActiveSupport::Concern
|
1406
|
+
|
1407
|
+
private
|
1408
|
+
|
1409
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/internal_channel.rb:10
|
1410
|
+
def internal_channel; end
|
1411
|
+
|
1412
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/internal_channel.rb:31
|
1413
|
+
def process_internal_message(message); end
|
1414
|
+
|
1415
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/internal_channel.rb:14
|
1416
|
+
def subscribe_to_internal_channel; end
|
1417
|
+
|
1418
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/internal_channel.rb:25
|
1419
|
+
def unsubscribe_from_internal_channel; end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
# Allows us to buffer messages received from the WebSocket before the Connection has been fully initialized, and is ready to receive them.
|
1423
|
+
#
|
1424
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:6
|
1425
|
+
class ActionCable::Connection::MessageBuffer
|
1426
|
+
# @return [MessageBuffer] a new instance of MessageBuffer
|
1427
|
+
#
|
1428
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:7
|
1429
|
+
def initialize(connection); end
|
1430
|
+
|
1431
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:12
|
1432
|
+
def append(message); end
|
1433
|
+
|
1434
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:28
|
1435
|
+
def process!; end
|
1436
|
+
|
1437
|
+
# @return [Boolean]
|
1438
|
+
#
|
1439
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:24
|
1440
|
+
def processing?; end
|
1441
|
+
|
1442
|
+
private
|
1443
|
+
|
1444
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:45
|
1445
|
+
def buffer(message); end
|
1446
|
+
|
1447
|
+
# Returns the value of attribute buffered_messages.
|
1448
|
+
#
|
1449
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:35
|
1450
|
+
def buffered_messages; end
|
1451
|
+
|
1452
|
+
# Returns the value of attribute connection.
|
1453
|
+
#
|
1454
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:34
|
1455
|
+
def connection; end
|
1456
|
+
|
1457
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:41
|
1458
|
+
def receive(message); end
|
1459
|
+
|
1460
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:49
|
1461
|
+
def receive_buffered_messages; end
|
1462
|
+
|
1463
|
+
# @return [Boolean]
|
1464
|
+
#
|
1465
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/message_buffer.rb:37
|
1466
|
+
def valid?(message); end
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:12
|
1470
|
+
class ActionCable::Connection::NonInferrableConnectionError < ::StandardError
|
1471
|
+
# @return [NonInferrableConnectionError] a new instance of NonInferrableConnectionError
|
1472
|
+
#
|
1473
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:13
|
1474
|
+
def initialize(name); end
|
1475
|
+
end
|
1476
|
+
|
1477
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:11
|
1478
|
+
class ActionCable::Connection::Stream
|
1479
|
+
# @return [Stream] a new instance of Stream
|
1480
|
+
#
|
1481
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:12
|
1482
|
+
def initialize(event_loop, socket); end
|
1483
|
+
|
1484
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:28
|
1485
|
+
def close; end
|
1486
|
+
|
1487
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:24
|
1488
|
+
def each(&callback); end
|
1489
|
+
|
1490
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:72
|
1491
|
+
def flush_write_buffer; end
|
1492
|
+
|
1493
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:98
|
1494
|
+
def hijack_rack_socket; end
|
1495
|
+
|
1496
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:94
|
1497
|
+
def receive(data); end
|
1498
|
+
|
1499
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:33
|
1500
|
+
def shutdown; end
|
1501
|
+
|
1502
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:37
|
1503
|
+
def write(data); end
|
1504
|
+
|
1505
|
+
private
|
1506
|
+
|
1507
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream.rb:110
|
1508
|
+
def clean_rack_hijack; end
|
1509
|
+
end
|
1510
|
+
|
1511
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:8
|
1512
|
+
class ActionCable::Connection::StreamEventLoop
|
1513
|
+
# @return [StreamEventLoop] a new instance of StreamEventLoop
|
1514
|
+
#
|
1515
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:9
|
1516
|
+
def initialize; end
|
1517
|
+
|
1518
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:29
|
1519
|
+
def attach(io, stream); end
|
1520
|
+
|
1521
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:37
|
1522
|
+
def detach(io, stream); end
|
1523
|
+
|
1524
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:22
|
1525
|
+
def post(task = T.unsafe(nil), &block); end
|
1526
|
+
|
1527
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:55
|
1528
|
+
def stop; end
|
1529
|
+
|
1530
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:18
|
1531
|
+
def timer(interval, &block); end
|
1532
|
+
|
1533
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:46
|
1534
|
+
def writes_pending(io); end
|
1535
|
+
|
1536
|
+
private
|
1537
|
+
|
1538
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:85
|
1539
|
+
def run; end
|
1540
|
+
|
1541
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:61
|
1542
|
+
def spawn; end
|
1543
|
+
|
1544
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/stream_event_loop.rb:81
|
1545
|
+
def wakeup; end
|
1546
|
+
end
|
1547
|
+
|
1548
|
+
# Collection class for all the channel subscriptions established on a given connection. Responsible for routing incoming commands that arrive on
|
1549
|
+
# the connection to the proper channel.
|
1550
|
+
#
|
1551
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:9
|
1552
|
+
class ActionCable::Connection::Subscriptions
|
1553
|
+
# @return [Subscriptions] a new instance of Subscriptions
|
1554
|
+
#
|
1555
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:10
|
1556
|
+
def initialize(connection); end
|
1557
|
+
|
1558
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:28
|
1559
|
+
def add(data); end
|
1560
|
+
|
1561
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:15
|
1562
|
+
def execute_command(data); end
|
1563
|
+
|
1564
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:59
|
1565
|
+
def identifiers; end
|
1566
|
+
|
1567
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:69
|
1568
|
+
def logger(*_arg0, &_arg1); end
|
1569
|
+
|
1570
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:55
|
1571
|
+
def perform_action(data); end
|
1572
|
+
|
1573
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:45
|
1574
|
+
def remove(data); end
|
1575
|
+
|
1576
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:50
|
1577
|
+
def remove_subscription(subscription); end
|
1578
|
+
|
1579
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:63
|
1580
|
+
def unsubscribe_from_all; end
|
1581
|
+
|
1582
|
+
private
|
1583
|
+
|
1584
|
+
# Returns the value of attribute connection.
|
1585
|
+
#
|
1586
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:68
|
1587
|
+
def connection; end
|
1588
|
+
|
1589
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:71
|
1590
|
+
def find(data); end
|
1591
|
+
|
1592
|
+
# Returns the value of attribute subscriptions.
|
1593
|
+
#
|
1594
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/subscriptions.rb:68
|
1595
|
+
def subscriptions; end
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
# Allows the use of per-connection tags against the server logger. This wouldn't work using the traditional
|
1599
|
+
# ActiveSupport::TaggedLogging enhanced Rails.logger, as that logger will reset the tags between requests.
|
1600
|
+
# The connection is long-lived, so it needs its own set of tags for its independent duration.
|
1601
|
+
#
|
1602
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:8
|
1603
|
+
class ActionCable::Connection::TaggedLoggerProxy
|
1604
|
+
# @return [TaggedLoggerProxy] a new instance of TaggedLoggerProxy
|
1605
|
+
#
|
1606
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:11
|
1607
|
+
def initialize(logger, tags:); end
|
1608
|
+
|
1609
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:16
|
1610
|
+
def add_tags(*tags); end
|
1611
|
+
|
1612
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1613
|
+
def debug(message); end
|
1614
|
+
|
1615
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1616
|
+
def error(message); end
|
1617
|
+
|
1618
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1619
|
+
def fatal(message); end
|
1620
|
+
|
1621
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1622
|
+
def info(message); end
|
1623
|
+
|
1624
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:21
|
1625
|
+
def tag(logger, &block); end
|
1626
|
+
|
1627
|
+
# Returns the value of attribute tags.
|
1628
|
+
#
|
1629
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:9
|
1630
|
+
def tags; end
|
1631
|
+
|
1632
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1633
|
+
def unknown(message); end
|
1634
|
+
|
1635
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:31
|
1636
|
+
def warn(message); end
|
1637
|
+
|
1638
|
+
private
|
1639
|
+
|
1640
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/tagged_logger_proxy.rb:37
|
1641
|
+
def log(type, message); end
|
1642
|
+
end
|
1643
|
+
|
1644
|
+
# Unit test Action Cable connections.
|
1645
|
+
#
|
1646
|
+
# Useful to check whether a connection's +identified_by+ gets assigned properly
|
1647
|
+
# and that any improper connection requests are rejected.
|
1648
|
+
#
|
1649
|
+
# == Basic example
|
1650
|
+
#
|
1651
|
+
# Unit tests are written as follows:
|
1652
|
+
#
|
1653
|
+
# 1. Simulate a connection attempt by calling +connect+.
|
1654
|
+
# 2. Assert state, e.g. identifiers, has been assigned.
|
1655
|
+
#
|
1656
|
+
#
|
1657
|
+
# class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
|
1658
|
+
# def test_connects_with_proper_cookie
|
1659
|
+
# # Simulate the connection request with a cookie.
|
1660
|
+
# cookies["user_id"] = users(:john).id
|
1661
|
+
#
|
1662
|
+
# connect
|
1663
|
+
#
|
1664
|
+
# # Assert the connection identifier matches the fixture.
|
1665
|
+
# assert_equal users(:john).id, connection.user.id
|
1666
|
+
# end
|
1667
|
+
#
|
1668
|
+
# def test_rejects_connection_without_proper_cookie
|
1669
|
+
# assert_reject_connection { connect }
|
1670
|
+
# end
|
1671
|
+
# end
|
1672
|
+
#
|
1673
|
+
# +connect+ accepts additional information about the HTTP request with the
|
1674
|
+
# +params+, +headers+, +session+, and Rack +env+ options.
|
1675
|
+
#
|
1676
|
+
# def test_connect_with_headers_and_query_string
|
1677
|
+
# connect params: { user_id: 1 }, headers: { "X-API-TOKEN" => "secret-my" }
|
1678
|
+
#
|
1679
|
+
# assert_equal "1", connection.user.id
|
1680
|
+
# assert_equal "secret-my", connection.token
|
1681
|
+
# end
|
1682
|
+
#
|
1683
|
+
# def test_connect_with_params
|
1684
|
+
# connect params: { user_id: 1 }
|
1685
|
+
#
|
1686
|
+
# assert_equal "1", connection.user.id
|
1687
|
+
# end
|
1688
|
+
#
|
1689
|
+
# You can also set up the correct cookies before the connection request:
|
1690
|
+
#
|
1691
|
+
# def test_connect_with_cookies
|
1692
|
+
# # Plain cookies:
|
1693
|
+
# cookies["user_id"] = 1
|
1694
|
+
#
|
1695
|
+
# # Or signed/encrypted:
|
1696
|
+
# # cookies.signed["user_id"] = 1
|
1697
|
+
# # cookies.encrypted["user_id"] = 1
|
1698
|
+
#
|
1699
|
+
# connect
|
1700
|
+
#
|
1701
|
+
# assert_equal "1", connection.user_id
|
1702
|
+
# end
|
1703
|
+
#
|
1704
|
+
# == Connection is automatically inferred
|
1705
|
+
#
|
1706
|
+
# ActionCable::Connection::TestCase will automatically infer the connection under test
|
1707
|
+
# from the test class name. If the channel cannot be inferred from the test
|
1708
|
+
# class name, you can explicitly set it with +tests+.
|
1709
|
+
#
|
1710
|
+
# class ConnectionTest < ActionCable::Connection::TestCase
|
1711
|
+
# tests ApplicationCable::Connection
|
1712
|
+
# end
|
1713
|
+
#
|
1714
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:129
|
1715
|
+
class ActionCable::Connection::TestCase < ::ActiveSupport::TestCase
|
1716
|
+
include ::ActiveSupport::Testing::ConstantLookup
|
1717
|
+
include ::ActionCable::Connection::Assertions
|
1718
|
+
include ::ActionCable::Connection::TestCase::Behavior
|
1719
|
+
extend ::ActiveSupport::Testing::ConstantLookup::ClassMethods
|
1720
|
+
extend ::ActionCable::Connection::TestCase::Behavior::ClassMethods
|
1721
|
+
|
1722
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1723
|
+
def _connection_class; end
|
1724
|
+
|
1725
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1726
|
+
def _connection_class=(_arg0); end
|
1727
|
+
|
1728
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1729
|
+
def _connection_class?; end
|
1730
|
+
|
1731
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:141
|
1732
|
+
def connection; end
|
1733
|
+
|
1734
|
+
class << self
|
1735
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1736
|
+
def _connection_class; end
|
1737
|
+
|
1738
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1739
|
+
def _connection_class=(value); end
|
1740
|
+
|
1741
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:139
|
1742
|
+
def _connection_class?; end
|
1743
|
+
end
|
1744
|
+
end
|
1745
|
+
|
1746
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:130
|
1747
|
+
module ActionCable::Connection::TestCase::Behavior
|
1748
|
+
include ::ActionCable::Connection::Assertions
|
1749
|
+
extend ::ActiveSupport::Concern
|
1750
|
+
include GeneratedInstanceMethods
|
1751
|
+
include ::ActiveSupport::Testing::ConstantLookup
|
1752
|
+
|
1753
|
+
mixes_in_class_methods GeneratedClassMethods
|
1754
|
+
mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods
|
1755
|
+
mixes_in_class_methods ::ActionCable::Connection::TestCase::Behavior::ClassMethods
|
1756
|
+
|
1757
|
+
# Performs connection attempt to exert #connect on the connection under test.
|
1758
|
+
#
|
1759
|
+
# Accepts request path as the first argument and the following request options:
|
1760
|
+
#
|
1761
|
+
# - params – URL parameters (Hash)
|
1762
|
+
# - headers – request headers (Hash)
|
1763
|
+
# - session – session data (Hash)
|
1764
|
+
# - env – additional Rack env configuration (Hash)
|
1765
|
+
#
|
1766
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:183
|
1767
|
+
def connect(path = T.unsafe(nil), **request_params); end
|
1768
|
+
|
1769
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:203
|
1770
|
+
def cookies; end
|
1771
|
+
|
1772
|
+
# Exert #disconnect on the connection under test.
|
1773
|
+
#
|
1774
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:196
|
1775
|
+
def disconnect; end
|
1776
|
+
|
1777
|
+
private
|
1778
|
+
|
1779
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:208
|
1780
|
+
def build_test_request(path, params: T.unsafe(nil), headers: T.unsafe(nil), session: T.unsafe(nil), env: T.unsafe(nil)); end
|
1781
|
+
|
1782
|
+
module GeneratedClassMethods
|
1783
|
+
def _connection_class; end
|
1784
|
+
def _connection_class=(value); end
|
1785
|
+
def _connection_class?; end
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
module GeneratedInstanceMethods
|
1789
|
+
def _connection_class; end
|
1790
|
+
def _connection_class=(value); end
|
1791
|
+
def _connection_class?; end
|
1792
|
+
end
|
1793
|
+
end
|
1794
|
+
|
1795
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:146
|
1796
|
+
module ActionCable::Connection::TestCase::Behavior::ClassMethods
|
1797
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:158
|
1798
|
+
def connection_class; end
|
1799
|
+
|
1800
|
+
# @raise [NonInferrableConnectionError]
|
1801
|
+
#
|
1802
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:166
|
1803
|
+
def determine_default_connection(name); end
|
1804
|
+
|
1805
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:147
|
1806
|
+
def tests(connection); end
|
1807
|
+
end
|
1808
|
+
|
1809
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:133
|
1810
|
+
ActionCable::Connection::TestCase::Behavior::DEFAULT_PATH = T.let(T.unsafe(nil), String)
|
1811
|
+
|
1812
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:47
|
1813
|
+
module ActionCable::Connection::TestConnection
|
1814
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:50
|
1815
|
+
def initialize(request); end
|
1816
|
+
|
1817
|
+
# Returns the value of attribute logger.
|
1818
|
+
#
|
1819
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:48
|
1820
|
+
def logger; end
|
1821
|
+
|
1822
|
+
# Returns the value of attribute request.
|
1823
|
+
#
|
1824
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:48
|
1825
|
+
def request; end
|
1826
|
+
end
|
1827
|
+
|
1828
|
+
# We don't want to use the whole "encryption stack" for connection
|
1829
|
+
# unit-tests, but we want to make sure that users test against the correct types
|
1830
|
+
# of cookies (i.e. signed or encrypted or plain)
|
1831
|
+
#
|
1832
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:33
|
1833
|
+
class ActionCable::Connection::TestCookieJar < ::ActiveSupport::HashWithIndifferentAccess
|
1834
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:38
|
1835
|
+
def encrypted; end
|
1836
|
+
|
1837
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:34
|
1838
|
+
def signed; end
|
1839
|
+
end
|
1840
|
+
|
1841
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:43
|
1842
|
+
class ActionCable::Connection::TestRequest < ::ActionDispatch::TestRequest
|
1843
|
+
# Returns the value of attribute cookie_jar.
|
1844
|
+
#
|
1845
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:44
|
1846
|
+
def cookie_jar; end
|
1847
|
+
|
1848
|
+
# Sets the attribute cookie_jar
|
1849
|
+
#
|
1850
|
+
# @param value the value to set the attribute cookie_jar to.
|
1851
|
+
#
|
1852
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:44
|
1853
|
+
def cookie_jar=(_arg0); end
|
1854
|
+
|
1855
|
+
# Returns the value of attribute session.
|
1856
|
+
#
|
1857
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:44
|
1858
|
+
def session; end
|
1859
|
+
|
1860
|
+
# Sets the attribute session
|
1861
|
+
#
|
1862
|
+
# @param value the value to set the attribute session to.
|
1863
|
+
#
|
1864
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/test_case.rb:44
|
1865
|
+
def session=(_arg0); end
|
1866
|
+
end
|
1867
|
+
|
1868
|
+
# Wrap the real socket to minimize the externally-presented API
|
1869
|
+
#
|
1870
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:8
|
1871
|
+
class ActionCable::Connection::WebSocket
|
1872
|
+
# @return [WebSocket] a new instance of WebSocket
|
1873
|
+
#
|
1874
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:9
|
1875
|
+
def initialize(env, event_target, event_loop, protocols: T.unsafe(nil)); end
|
1876
|
+
|
1877
|
+
# @return [Boolean]
|
1878
|
+
#
|
1879
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:17
|
1880
|
+
def alive?; end
|
1881
|
+
|
1882
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:25
|
1883
|
+
def close; end
|
1884
|
+
|
1885
|
+
# @return [Boolean]
|
1886
|
+
#
|
1887
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:13
|
1888
|
+
def possible?; end
|
1889
|
+
|
1890
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:29
|
1891
|
+
def protocol; end
|
1892
|
+
|
1893
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:33
|
1894
|
+
def rack_response; end
|
1895
|
+
|
1896
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:21
|
1897
|
+
def transmit(data); end
|
1898
|
+
|
1899
|
+
private
|
1900
|
+
|
1901
|
+
# Returns the value of attribute websocket.
|
1902
|
+
#
|
1903
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb:38
|
1904
|
+
def websocket; end
|
1905
|
+
end
|
1906
|
+
|
1907
|
+
# source://actioncable-7.0.3.1/lib/action_cable/engine.rb:9
|
1908
|
+
class ActionCable::Engine < ::Rails::Engine; end
|
1909
|
+
|
1910
|
+
# source://actioncable-7.0.3.1/lib/action_cable/helpers/action_cable_helper.rb:4
|
1911
|
+
module ActionCable::Helpers; end
|
1912
|
+
|
1913
|
+
# source://actioncable-7.0.3.1/lib/action_cable/helpers/action_cable_helper.rb:5
|
1914
|
+
module ActionCable::Helpers::ActionCableHelper
|
1915
|
+
# Returns an "action-cable-url" meta tag with the value of the URL specified in your
|
1916
|
+
# configuration. Ensure this is above your JavaScript tag:
|
1917
|
+
#
|
1918
|
+
# <head>
|
1919
|
+
# <%= action_cable_meta_tag %>
|
1920
|
+
# <%= javascript_include_tag 'application', 'data-turbo-track' => 'reload' %>
|
1921
|
+
# </head>
|
1922
|
+
#
|
1923
|
+
# This is then used by Action Cable to determine the URL of your WebSocket server.
|
1924
|
+
# Your JavaScript can then connect to the server without needing to specify the
|
1925
|
+
# URL directly:
|
1926
|
+
#
|
1927
|
+
# import Cable from "@rails/actioncable"
|
1928
|
+
# window.Cable = Cable
|
1929
|
+
# window.App = {}
|
1930
|
+
# App.cable = Cable.createConsumer()
|
1931
|
+
#
|
1932
|
+
# Make sure to specify the correct server location in each of your environment
|
1933
|
+
# config files:
|
1934
|
+
#
|
1935
|
+
# config.action_cable.mount_path = "/cable123"
|
1936
|
+
# <%= action_cable_meta_tag %> would render:
|
1937
|
+
# => <meta name="action-cable-url" content="/cable123" />
|
1938
|
+
#
|
1939
|
+
# config.action_cable.url = "ws://actioncable.com"
|
1940
|
+
# <%= action_cable_meta_tag %> would render:
|
1941
|
+
# => <meta name="action-cable-url" content="ws://actioncable.com" />
|
1942
|
+
#
|
1943
|
+
# source://actioncable-7.0.3.1/lib/action_cable/helpers/action_cable_helper.rb:34
|
1944
|
+
def action_cable_meta_tag; end
|
1945
|
+
end
|
1946
|
+
|
1947
|
+
# source://actioncable-7.0.3.1/lib/action_cable.rb:33
|
1948
|
+
ActionCable::INTERNAL = T.let(T.unsafe(nil), Hash)
|
1949
|
+
|
1950
|
+
# If you need to disconnect a given connection, you can go through the
|
1951
|
+
# RemoteConnections. You can find the connections you're looking for by
|
1952
|
+
# searching for the identifier declared on the connection. For example:
|
1953
|
+
#
|
1954
|
+
# module ApplicationCable
|
1955
|
+
# class Connection < ActionCable::Connection::Base
|
1956
|
+
# identified_by :current_user
|
1957
|
+
# ....
|
1958
|
+
# end
|
1959
|
+
# end
|
1960
|
+
#
|
1961
|
+
# ActionCable.server.remote_connections.where(current_user: User.find(1)).disconnect
|
1962
|
+
#
|
1963
|
+
# This will disconnect all the connections established for
|
1964
|
+
# <tt>User.find(1)</tt>, across all servers running on all machines, because
|
1965
|
+
# it uses the internal channel that all of these servers are subscribed to.
|
1966
|
+
#
|
1967
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:22
|
1968
|
+
class ActionCable::RemoteConnections
|
1969
|
+
# @return [RemoteConnections] a new instance of RemoteConnections
|
1970
|
+
#
|
1971
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:25
|
1972
|
+
def initialize(server); end
|
1973
|
+
|
1974
|
+
# Returns the value of attribute server.
|
1975
|
+
#
|
1976
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:23
|
1977
|
+
def server; end
|
1978
|
+
|
1979
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:29
|
1980
|
+
def where(identifier); end
|
1981
|
+
end
|
1982
|
+
|
1983
|
+
# Represents a single remote connection found via <tt>ActionCable.server.remote_connections.where(*)</tt>.
|
1984
|
+
# Exists solely for the purpose of calling #disconnect on that connection.
|
1985
|
+
#
|
1986
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:36
|
1987
|
+
class ActionCable::RemoteConnections::RemoteConnection
|
1988
|
+
include ::ActionCable::Connection::InternalChannel
|
1989
|
+
include ::ActionCable::Connection::Identification
|
1990
|
+
extend ::ActionCable::Connection::Identification::ClassMethods
|
1991
|
+
|
1992
|
+
# @return [RemoteConnection] a new instance of RemoteConnection
|
1993
|
+
#
|
1994
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:41
|
1995
|
+
def initialize(server, ids); end
|
1996
|
+
|
1997
|
+
# Uses the internal channel to disconnect the connection.
|
1998
|
+
#
|
1999
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:47
|
2000
|
+
def disconnect; end
|
2001
|
+
|
2002
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:52
|
2003
|
+
def identifiers; end
|
2004
|
+
|
2005
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
2006
|
+
def identifiers=(_arg0); end
|
2007
|
+
|
2008
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
2009
|
+
def identifiers?; end
|
2010
|
+
|
2011
|
+
protected
|
2012
|
+
|
2013
|
+
# Returns the value of attribute server.
|
2014
|
+
#
|
2015
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:57
|
2016
|
+
def server; end
|
2017
|
+
|
2018
|
+
private
|
2019
|
+
|
2020
|
+
# @raise [InvalidIdentifiersError]
|
2021
|
+
#
|
2022
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:60
|
2023
|
+
def set_identifier_instance_vars(ids); end
|
2024
|
+
|
2025
|
+
# @return [Boolean]
|
2026
|
+
#
|
2027
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:65
|
2028
|
+
def valid_identifiers?(ids); end
|
2029
|
+
|
2030
|
+
class << self
|
2031
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
2032
|
+
def identifiers; end
|
2033
|
+
|
2034
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
2035
|
+
def identifiers=(value); end
|
2036
|
+
|
2037
|
+
# source://actioncable-7.0.3.1/lib/action_cable/connection/identification.rb:11
|
2038
|
+
def identifiers?; end
|
2039
|
+
end
|
2040
|
+
end
|
2041
|
+
|
2042
|
+
# source://actioncable-7.0.3.1/lib/action_cable/remote_connections.rb:37
|
2043
|
+
class ActionCable::RemoteConnections::RemoteConnection::InvalidIdentifiersError < ::StandardError; end
|
2044
|
+
|
2045
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server.rb:4
|
2046
|
+
module ActionCable::Server
|
2047
|
+
extend ::ActiveSupport::Autoload
|
2048
|
+
end
|
2049
|
+
|
2050
|
+
# A singleton ActionCable::Server instance is available via ActionCable.server. It's used by the Rack process that starts the Action Cable server, but
|
2051
|
+
# is also used by the user to reach the RemoteConnections object, which is used for finding and disconnecting connections across all servers.
|
2052
|
+
#
|
2053
|
+
# Also, this is the server instance used for broadcasting. See Broadcasting for more information.
|
2054
|
+
#
|
2055
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:11
|
2056
|
+
class ActionCable::Server::Base
|
2057
|
+
include ::ActionCable::Server::Broadcasting
|
2058
|
+
include ::ActionCable::Server::Connections
|
2059
|
+
|
2060
|
+
# @return [Base] a new instance of Base
|
2061
|
+
#
|
2062
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:24
|
2063
|
+
def initialize(config: T.unsafe(nil)); end
|
2064
|
+
|
2065
|
+
# Called by Rack to set up the server.
|
2066
|
+
#
|
2067
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:31
|
2068
|
+
def call(env); end
|
2069
|
+
|
2070
|
+
# Returns the value of attribute config.
|
2071
|
+
#
|
2072
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:17
|
2073
|
+
def config; end
|
2074
|
+
|
2075
|
+
# All of the identifiers applied to the connection class associated with this server.
|
2076
|
+
#
|
2077
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:87
|
2078
|
+
def connection_identifiers; end
|
2079
|
+
|
2080
|
+
# Disconnect all the connections identified by +identifiers+ on this server or any others via RemoteConnections.
|
2081
|
+
#
|
2082
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:37
|
2083
|
+
def disconnect(identifiers); end
|
2084
|
+
|
2085
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:62
|
2086
|
+
def event_loop; end
|
2087
|
+
|
2088
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:20
|
2089
|
+
def logger(*_arg0, &_arg1); end
|
2090
|
+
|
2091
|
+
# Returns the value of attribute mutex.
|
2092
|
+
#
|
2093
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:22
|
2094
|
+
def mutex; end
|
2095
|
+
|
2096
|
+
# Adapter used for all streams/broadcasting.
|
2097
|
+
#
|
2098
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:82
|
2099
|
+
def pubsub; end
|
2100
|
+
|
2101
|
+
# Gateway to RemoteConnections. See that class for details.
|
2102
|
+
#
|
2103
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:58
|
2104
|
+
def remote_connections; end
|
2105
|
+
|
2106
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:41
|
2107
|
+
def restart; end
|
2108
|
+
|
2109
|
+
# The worker pool is where we run connection callbacks and channel actions. We do as little as possible on the server's main thread.
|
2110
|
+
# The worker pool is an executor service that's backed by a pool of threads working from a task queue. The thread pool size maxes out
|
2111
|
+
# at 4 worker threads by default. Tune the size yourself with <tt>config.action_cable.worker_pool_size</tt>.
|
2112
|
+
#
|
2113
|
+
# Using Active Record, Redis, etc within your channel actions means you'll get a separate connection from each thread in the worker pool.
|
2114
|
+
# Plan your deployment accordingly: 5 servers each running 5 Puma workers each running an 8-thread worker pool means at least 200 database
|
2115
|
+
# connections.
|
2116
|
+
#
|
2117
|
+
# Also, ensure that your database connection pool size is as least as large as your worker pool size. Otherwise, workers may oversubscribe
|
2118
|
+
# the database connection pool and block while they wait for other workers to release their connections. Use a smaller worker pool or a larger
|
2119
|
+
# database connection pool instead.
|
2120
|
+
#
|
2121
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:77
|
2122
|
+
def worker_pool; end
|
2123
|
+
|
2124
|
+
class << self
|
2125
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:15
|
2126
|
+
def config; end
|
2127
|
+
|
2128
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:15
|
2129
|
+
def config=(val); end
|
2130
|
+
|
2131
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/base.rb:19
|
2132
|
+
def logger; end
|
2133
|
+
end
|
2134
|
+
end
|
2135
|
+
|
2136
|
+
# Broadcasting is how other parts of your application can send messages to a channel's subscribers. As explained in Channel, most of the time, these
|
2137
|
+
# broadcastings are streamed directly to the clients subscribed to the named broadcasting. Let's explain with a full-stack example:
|
2138
|
+
#
|
2139
|
+
# class WebNotificationsChannel < ApplicationCable::Channel
|
2140
|
+
# def subscribed
|
2141
|
+
# stream_from "web_notifications_#{current_user.id}"
|
2142
|
+
# end
|
2143
|
+
# end
|
2144
|
+
#
|
2145
|
+
# # Somewhere in your app this is called, perhaps from a NewCommentJob:
|
2146
|
+
# ActionCable.server.broadcast \
|
2147
|
+
# "web_notifications_1", { title: "New things!", body: "All that's fit for print" }
|
2148
|
+
#
|
2149
|
+
# # Client-side CoffeeScript, which assumes you've already requested the right to send web notifications:
|
2150
|
+
# App.cable.subscriptions.create "WebNotificationsChannel",
|
2151
|
+
# received: (data) ->
|
2152
|
+
# new Notification data['title'], body: data['body']
|
2153
|
+
#
|
2154
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:22
|
2155
|
+
module ActionCable::Server::Broadcasting
|
2156
|
+
# Broadcast a hash directly to a named <tt>broadcasting</tt>. This will later be JSON encoded.
|
2157
|
+
#
|
2158
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:24
|
2159
|
+
def broadcast(broadcasting, message, coder: T.unsafe(nil)); end
|
2160
|
+
|
2161
|
+
# Returns a broadcaster for a named <tt>broadcasting</tt> that can be reused. Useful when you have an object that
|
2162
|
+
# may need multiple spots to transmit to a specific broadcasting over and over.
|
2163
|
+
#
|
2164
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:30
|
2165
|
+
def broadcaster_for(broadcasting, coder: T.unsafe(nil)); end
|
2166
|
+
end
|
2167
|
+
|
2168
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:35
|
2169
|
+
class ActionCable::Server::Broadcasting::Broadcaster
|
2170
|
+
# @return [Broadcaster] a new instance of Broadcaster
|
2171
|
+
#
|
2172
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:38
|
2173
|
+
def initialize(server, broadcasting, coder:); end
|
2174
|
+
|
2175
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:42
|
2176
|
+
def broadcast(message); end
|
2177
|
+
|
2178
|
+
# Returns the value of attribute broadcasting.
|
2179
|
+
#
|
2180
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:36
|
2181
|
+
def broadcasting; end
|
2182
|
+
|
2183
|
+
# Returns the value of attribute coder.
|
2184
|
+
#
|
2185
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:36
|
2186
|
+
def coder; end
|
2187
|
+
|
2188
|
+
# Returns the value of attribute server.
|
2189
|
+
#
|
2190
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/broadcasting.rb:36
|
2191
|
+
def server; end
|
2192
|
+
end
|
2193
|
+
|
2194
|
+
# An instance of this configuration object is available via ActionCable.server.config, which allows you to tweak Action Cable configuration
|
2195
|
+
# in a Rails config initializer.
|
2196
|
+
#
|
2197
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:7
|
2198
|
+
class ActionCable::Server::Configuration
|
2199
|
+
# @return [Configuration] a new instance of Configuration
|
2200
|
+
#
|
2201
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:14
|
2202
|
+
def initialize; end
|
2203
|
+
|
2204
|
+
# Returns the value of attribute allow_same_origin_as_host.
|
2205
|
+
#
|
2206
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2207
|
+
def allow_same_origin_as_host; end
|
2208
|
+
|
2209
|
+
# Sets the attribute allow_same_origin_as_host
|
2210
|
+
#
|
2211
|
+
# @param value the value to set the attribute allow_same_origin_as_host to.
|
2212
|
+
#
|
2213
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2214
|
+
def allow_same_origin_as_host=(_arg0); end
|
2215
|
+
|
2216
|
+
# Returns the value of attribute allowed_request_origins.
|
2217
|
+
#
|
2218
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2219
|
+
def allowed_request_origins; end
|
2220
|
+
|
2221
|
+
# Sets the attribute allowed_request_origins
|
2222
|
+
#
|
2223
|
+
# @param value the value to set the attribute allowed_request_origins to.
|
2224
|
+
#
|
2225
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2226
|
+
def allowed_request_origins=(_arg0); end
|
2227
|
+
|
2228
|
+
# Returns the value of attribute cable.
|
2229
|
+
#
|
2230
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2231
|
+
def cable; end
|
2232
|
+
|
2233
|
+
# Sets the attribute cable
|
2234
|
+
#
|
2235
|
+
# @param value the value to set the attribute cable to.
|
2236
|
+
#
|
2237
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2238
|
+
def cable=(_arg0); end
|
2239
|
+
|
2240
|
+
# Returns the value of attribute connection_class.
|
2241
|
+
#
|
2242
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:9
|
2243
|
+
def connection_class; end
|
2244
|
+
|
2245
|
+
# Sets the attribute connection_class
|
2246
|
+
#
|
2247
|
+
# @param value the value to set the attribute connection_class to.
|
2248
|
+
#
|
2249
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:9
|
2250
|
+
def connection_class=(_arg0); end
|
2251
|
+
|
2252
|
+
# Returns the value of attribute disable_request_forgery_protection.
|
2253
|
+
#
|
2254
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2255
|
+
def disable_request_forgery_protection; end
|
2256
|
+
|
2257
|
+
# Sets the attribute disable_request_forgery_protection
|
2258
|
+
#
|
2259
|
+
# @param value the value to set the attribute disable_request_forgery_protection to.
|
2260
|
+
#
|
2261
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:10
|
2262
|
+
def disable_request_forgery_protection=(_arg0); end
|
2263
|
+
|
2264
|
+
# Returns the value of attribute log_tags.
|
2265
|
+
#
|
2266
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:8
|
2267
|
+
def log_tags; end
|
2268
|
+
|
2269
|
+
# Sets the attribute log_tags
|
2270
|
+
#
|
2271
|
+
# @param value the value to set the attribute log_tags to.
|
2272
|
+
#
|
2273
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:8
|
2274
|
+
def log_tags=(_arg0); end
|
2275
|
+
|
2276
|
+
# Returns the value of attribute logger.
|
2277
|
+
#
|
2278
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:8
|
2279
|
+
def logger; end
|
2280
|
+
|
2281
|
+
# Sets the attribute logger
|
2282
|
+
#
|
2283
|
+
# @param value the value to set the attribute logger to.
|
2284
|
+
#
|
2285
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:8
|
2286
|
+
def logger=(_arg0); end
|
2287
|
+
|
2288
|
+
# Returns the value of attribute mount_path.
|
2289
|
+
#
|
2290
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2291
|
+
def mount_path; end
|
2292
|
+
|
2293
|
+
# Sets the attribute mount_path
|
2294
|
+
#
|
2295
|
+
# @param value the value to set the attribute mount_path to.
|
2296
|
+
#
|
2297
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2298
|
+
def mount_path=(_arg0); end
|
2299
|
+
|
2300
|
+
# Returns the value of attribute precompile_assets.
|
2301
|
+
#
|
2302
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:12
|
2303
|
+
def precompile_assets; end
|
2304
|
+
|
2305
|
+
# Sets the attribute precompile_assets
|
2306
|
+
#
|
2307
|
+
# @param value the value to set the attribute precompile_assets to.
|
2308
|
+
#
|
2309
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:12
|
2310
|
+
def precompile_assets=(_arg0); end
|
2311
|
+
|
2312
|
+
# Returns constant of subscription adapter specified in config/cable.yml.
|
2313
|
+
# If the adapter cannot be found, this will default to the Redis adapter.
|
2314
|
+
# Also makes sure proper dependencies are required.
|
2315
|
+
#
|
2316
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:27
|
2317
|
+
def pubsub_adapter; end
|
2318
|
+
|
2319
|
+
# Returns the value of attribute url.
|
2320
|
+
#
|
2321
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2322
|
+
def url; end
|
2323
|
+
|
2324
|
+
# Sets the attribute url
|
2325
|
+
#
|
2326
|
+
# @param value the value to set the attribute url to.
|
2327
|
+
#
|
2328
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:11
|
2329
|
+
def url=(_arg0); end
|
2330
|
+
|
2331
|
+
# Returns the value of attribute worker_pool_size.
|
2332
|
+
#
|
2333
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:9
|
2334
|
+
def worker_pool_size; end
|
2335
|
+
|
2336
|
+
# Sets the attribute worker_pool_size
|
2337
|
+
#
|
2338
|
+
# @param value the value to set the attribute worker_pool_size to.
|
2339
|
+
#
|
2340
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/configuration.rb:9
|
2341
|
+
def worker_pool_size=(_arg0); end
|
2342
|
+
end
|
2343
|
+
|
2344
|
+
# Collection class for all the connections that have been established on this specific server. Remember, usually you'll run many Action Cable servers, so
|
2345
|
+
# you can't use this collection as a full list of all of the connections established against your application. Instead, use RemoteConnections for that.
|
2346
|
+
#
|
2347
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:7
|
2348
|
+
module ActionCable::Server::Connections
|
2349
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:14
|
2350
|
+
def add_connection(connection); end
|
2351
|
+
|
2352
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:10
|
2353
|
+
def connections; end
|
2354
|
+
|
2355
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:31
|
2356
|
+
def open_connections_statistics; end
|
2357
|
+
|
2358
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:18
|
2359
|
+
def remove_connection(connection); end
|
2360
|
+
|
2361
|
+
# WebSocket connection implementations differ on when they'll mark a connection as stale. We basically never want a connection to go stale, as you
|
2362
|
+
# then can't rely on being able to communicate with the connection. To solve this, a 3 second heartbeat runs on all connections. If the beat fails, we automatically
|
2363
|
+
# disconnect.
|
2364
|
+
#
|
2365
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:25
|
2366
|
+
def setup_heartbeat_timer; end
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/connections.rb:8
|
2370
|
+
ActionCable::Server::Connections::BEAT_INTERVAL = T.let(T.unsafe(nil), Integer)
|
2371
|
+
|
2372
|
+
# Worker used by Server.send_async to do connection work in threads.
|
2373
|
+
#
|
2374
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker/active_record_connection_management.rb:5
|
2375
|
+
class ActionCable::Server::Worker
|
2376
|
+
include ::ActiveSupport::Callbacks
|
2377
|
+
include ::ActionCable::Server::Worker::ActiveRecordConnectionManagement
|
2378
|
+
extend ::ActiveSupport::Callbacks::ClassMethods
|
2379
|
+
extend ::ActiveSupport::DescendantsTracker
|
2380
|
+
|
2381
|
+
# @return [Worker] a new instance of Worker
|
2382
|
+
#
|
2383
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:20
|
2384
|
+
def initialize(max_size: T.unsafe(nil)); end
|
2385
|
+
|
2386
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
2387
|
+
def __callbacks; end
|
2388
|
+
|
2389
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
2390
|
+
def __callbacks?; end
|
2391
|
+
|
2392
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:928
|
2393
|
+
def _run_work_callbacks(&block); end
|
2394
|
+
|
2395
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:940
|
2396
|
+
def _work_callbacks; end
|
2397
|
+
|
2398
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:47
|
2399
|
+
def async_exec(receiver, *args, connection:, &block); end
|
2400
|
+
|
2401
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:51
|
2402
|
+
def async_invoke(receiver, method, *args, connection: T.unsafe(nil), &block); end
|
2403
|
+
|
2404
|
+
# source://activesupport-7.0.3.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:56
|
2405
|
+
def connection; end
|
2406
|
+
|
2407
|
+
# source://activesupport-7.0.3.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:100
|
2408
|
+
def connection=(obj); end
|
2409
|
+
|
2410
|
+
# Returns the value of attribute executor.
|
2411
|
+
#
|
2412
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:18
|
2413
|
+
def executor; end
|
2414
|
+
|
2415
|
+
# Stop processing work: any work that has not already started
|
2416
|
+
# running will be discarded from the queue
|
2417
|
+
#
|
2418
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:31
|
2419
|
+
def halt; end
|
2420
|
+
|
2421
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:57
|
2422
|
+
def invoke(receiver, method, *args, connection:, &block); end
|
2423
|
+
|
2424
|
+
# @return [Boolean]
|
2425
|
+
#
|
2426
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:35
|
2427
|
+
def stopping?; end
|
2428
|
+
|
2429
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:39
|
2430
|
+
def work(connection, &block); end
|
2431
|
+
|
2432
|
+
private
|
2433
|
+
|
2434
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker.rb:69
|
2435
|
+
def logger; end
|
2436
|
+
|
2437
|
+
class << self
|
2438
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
2439
|
+
def __callbacks; end
|
2440
|
+
|
2441
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
2442
|
+
def __callbacks=(value); end
|
2443
|
+
|
2444
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:68
|
2445
|
+
def __callbacks?; end
|
2446
|
+
|
2447
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:932
|
2448
|
+
def _work_callbacks; end
|
2449
|
+
|
2450
|
+
# source://activesupport-7.0.3.1/lib/active_support/callbacks.rb:936
|
2451
|
+
def _work_callbacks=(value); end
|
2452
|
+
|
2453
|
+
# source://activesupport-7.0.3.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:48
|
2454
|
+
def connection; end
|
2455
|
+
|
2456
|
+
# source://activesupport-7.0.3.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb:92
|
2457
|
+
def connection=(obj); end
|
2458
|
+
end
|
2459
|
+
end
|
2460
|
+
|
2461
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker/active_record_connection_management.rb:6
|
2462
|
+
module ActionCable::Server::Worker::ActiveRecordConnectionManagement
|
2463
|
+
extend ::ActiveSupport::Concern
|
2464
|
+
|
2465
|
+
# source://actioncable-7.0.3.1/lib/action_cable/server/worker/active_record_connection_management.rb:15
|
2466
|
+
def with_database_connections(&block); end
|
2467
|
+
end
|
2468
|
+
|
2469
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter.rb:4
|
2470
|
+
module ActionCable::SubscriptionAdapter
|
2471
|
+
extend ::ActiveSupport::Autoload
|
2472
|
+
end
|
2473
|
+
|
2474
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:7
|
2475
|
+
class ActionCable::SubscriptionAdapter::Async < ::ActionCable::SubscriptionAdapter::Inline
|
2476
|
+
private
|
2477
|
+
|
2478
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:9
|
2479
|
+
def new_subscriber_map; end
|
2480
|
+
end
|
2481
|
+
|
2482
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:13
|
2483
|
+
class ActionCable::SubscriptionAdapter::Async::AsyncSubscriberMap < ::ActionCable::SubscriptionAdapter::SubscriberMap
|
2484
|
+
# @return [AsyncSubscriberMap] a new instance of AsyncSubscriberMap
|
2485
|
+
#
|
2486
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:14
|
2487
|
+
def initialize(event_loop); end
|
2488
|
+
|
2489
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:19
|
2490
|
+
def add_subscriber(*_arg0); end
|
2491
|
+
|
2492
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/async.rb:23
|
2493
|
+
def invoke_callback(*_arg0); end
|
2494
|
+
end
|
2495
|
+
|
2496
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:5
|
2497
|
+
class ActionCable::SubscriptionAdapter::Base
|
2498
|
+
# @return [Base] a new instance of Base
|
2499
|
+
#
|
2500
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:8
|
2501
|
+
def initialize(server); end
|
2502
|
+
|
2503
|
+
# @raise [NotImplementedError]
|
2504
|
+
#
|
2505
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:13
|
2506
|
+
def broadcast(channel, payload); end
|
2507
|
+
|
2508
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:29
|
2509
|
+
def identifier; end
|
2510
|
+
|
2511
|
+
# Returns the value of attribute logger.
|
2512
|
+
#
|
2513
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:6
|
2514
|
+
def logger; end
|
2515
|
+
|
2516
|
+
# Returns the value of attribute server.
|
2517
|
+
#
|
2518
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:6
|
2519
|
+
def server; end
|
2520
|
+
|
2521
|
+
# @raise [NotImplementedError]
|
2522
|
+
#
|
2523
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:25
|
2524
|
+
def shutdown; end
|
2525
|
+
|
2526
|
+
# @raise [NotImplementedError]
|
2527
|
+
#
|
2528
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:17
|
2529
|
+
def subscribe(channel, message_callback, success_callback = T.unsafe(nil)); end
|
2530
|
+
|
2531
|
+
# @raise [NotImplementedError]
|
2532
|
+
#
|
2533
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/base.rb:21
|
2534
|
+
def unsubscribe(channel, message_callback); end
|
2535
|
+
end
|
2536
|
+
|
2537
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/channel_prefix.rb:5
|
2538
|
+
module ActionCable::SubscriptionAdapter::ChannelPrefix
|
2539
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/channel_prefix.rb:6
|
2540
|
+
def broadcast(channel, payload); end
|
2541
|
+
|
2542
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/channel_prefix.rb:11
|
2543
|
+
def subscribe(channel, callback, success_callback = T.unsafe(nil)); end
|
2544
|
+
|
2545
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/channel_prefix.rb:16
|
2546
|
+
def unsubscribe(channel, callback); end
|
2547
|
+
|
2548
|
+
private
|
2549
|
+
|
2550
|
+
# Returns the channel name, including channel_prefix specified in cable.yml
|
2551
|
+
#
|
2552
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/channel_prefix.rb:23
|
2553
|
+
def channel_with_prefix(channel); end
|
2554
|
+
end
|
2555
|
+
|
2556
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:5
|
2557
|
+
class ActionCable::SubscriptionAdapter::Inline < ::ActionCable::SubscriptionAdapter::Base
|
2558
|
+
# @return [Inline] a new instance of Inline
|
2559
|
+
#
|
2560
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:6
|
2561
|
+
def initialize(*_arg0); end
|
2562
|
+
|
2563
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:11
|
2564
|
+
def broadcast(channel, payload); end
|
2565
|
+
|
2566
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:23
|
2567
|
+
def shutdown; end
|
2568
|
+
|
2569
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:15
|
2570
|
+
def subscribe(channel, callback, success_callback = T.unsafe(nil)); end
|
2571
|
+
|
2572
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:19
|
2573
|
+
def unsubscribe(channel, callback); end
|
2574
|
+
|
2575
|
+
private
|
2576
|
+
|
2577
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:32
|
2578
|
+
def new_subscriber_map; end
|
2579
|
+
|
2580
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/inline.rb:28
|
2581
|
+
def subscriber_map; end
|
2582
|
+
end
|
2583
|
+
|
2584
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:5
|
2585
|
+
class ActionCable::SubscriptionAdapter::SubscriberMap
|
2586
|
+
# @return [SubscriberMap] a new instance of SubscriberMap
|
2587
|
+
#
|
2588
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:6
|
2589
|
+
def initialize; end
|
2590
|
+
|
2591
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:47
|
2592
|
+
def add_channel(channel, on_success); end
|
2593
|
+
|
2594
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:11
|
2595
|
+
def add_subscriber(channel, subscriber, on_success); end
|
2596
|
+
|
2597
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:36
|
2598
|
+
def broadcast(channel, message); end
|
2599
|
+
|
2600
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:54
|
2601
|
+
def invoke_callback(callback, message); end
|
2602
|
+
|
2603
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:51
|
2604
|
+
def remove_channel(channel); end
|
2605
|
+
|
2606
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/subscriber_map.rb:25
|
2607
|
+
def remove_subscriber(channel, subscriber); end
|
2608
|
+
end
|
2609
|
+
|
2610
|
+
# == Test adapter for Action Cable
|
2611
|
+
#
|
2612
|
+
# The test adapter should be used only in testing. Along with
|
2613
|
+
# ActionCable::TestHelper it makes a great tool to test your Rails application.
|
2614
|
+
#
|
2615
|
+
# To use the test adapter set +adapter+ value to +test+ in your +config/cable.yml+ file.
|
2616
|
+
#
|
2617
|
+
# NOTE: Test adapter extends the <tt>ActionCable::SubscriptionsAdapter::Async</tt> adapter,
|
2618
|
+
# so it could be used in system tests too.
|
2619
|
+
#
|
2620
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:16
|
2621
|
+
class ActionCable::SubscriptionAdapter::Test < ::ActionCable::SubscriptionAdapter::Async
|
2622
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:17
|
2623
|
+
def broadcast(channel, payload); end
|
2624
|
+
|
2625
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:22
|
2626
|
+
def broadcasts(channel); end
|
2627
|
+
|
2628
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:30
|
2629
|
+
def clear; end
|
2630
|
+
|
2631
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:26
|
2632
|
+
def clear_messages(channel); end
|
2633
|
+
|
2634
|
+
private
|
2635
|
+
|
2636
|
+
# source://actioncable-7.0.3.1/lib/action_cable/subscription_adapter/test.rb:35
|
2637
|
+
def channels_data; end
|
2638
|
+
end
|
2639
|
+
|
2640
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_case.rb:6
|
2641
|
+
class ActionCable::TestCase < ::ActiveSupport::TestCase
|
2642
|
+
include ::ActionCable::TestHelper
|
2643
|
+
end
|
2644
|
+
|
2645
|
+
# Provides helper methods for testing Action Cable broadcasting
|
2646
|
+
#
|
2647
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:5
|
2648
|
+
module ActionCable::TestHelper
|
2649
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:16
|
2650
|
+
def after_teardown; end
|
2651
|
+
|
2652
|
+
# Asserts that the specified message has been sent to the stream.
|
2653
|
+
#
|
2654
|
+
# def test_assert_transmitted_message
|
2655
|
+
# ActionCable.server.broadcast 'messages', text: 'hello'
|
2656
|
+
# assert_broadcast_on('messages', text: 'hello')
|
2657
|
+
# end
|
2658
|
+
#
|
2659
|
+
# If a block is passed, that block should cause a message with the specified data to be sent.
|
2660
|
+
#
|
2661
|
+
# def test_assert_broadcast_on_again
|
2662
|
+
# assert_broadcast_on('messages', text: 'hello') do
|
2663
|
+
# ActionCable.server.broadcast 'messages', text: 'hello'
|
2664
|
+
# end
|
2665
|
+
# end
|
2666
|
+
#
|
2667
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:97
|
2668
|
+
def assert_broadcast_on(stream, data, &block); end
|
2669
|
+
|
2670
|
+
# Asserts that the number of broadcasted messages to the stream matches the given number.
|
2671
|
+
#
|
2672
|
+
# def test_broadcasts
|
2673
|
+
# assert_broadcasts 'messages', 0
|
2674
|
+
# ActionCable.server.broadcast 'messages', { text: 'hello' }
|
2675
|
+
# assert_broadcasts 'messages', 1
|
2676
|
+
# ActionCable.server.broadcast 'messages', { text: 'world' }
|
2677
|
+
# assert_broadcasts 'messages', 2
|
2678
|
+
# end
|
2679
|
+
#
|
2680
|
+
# If a block is passed, that block should cause the specified number of
|
2681
|
+
# messages to be broadcasted.
|
2682
|
+
#
|
2683
|
+
# def test_broadcasts_again
|
2684
|
+
# assert_broadcasts('messages', 1) do
|
2685
|
+
# ActionCable.server.broadcast 'messages', { text: 'hello' }
|
2686
|
+
# end
|
2687
|
+
#
|
2688
|
+
# assert_broadcasts('messages', 2) do
|
2689
|
+
# ActionCable.server.broadcast 'messages', { text: 'hi' }
|
2690
|
+
# ActionCable.server.broadcast 'messages', { text: 'how are you?' }
|
2691
|
+
# end
|
2692
|
+
# end
|
2693
|
+
#
|
2694
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:45
|
2695
|
+
def assert_broadcasts(stream, number, &block); end
|
2696
|
+
|
2697
|
+
# Asserts that no messages have been sent to the stream.
|
2698
|
+
#
|
2699
|
+
# def test_no_broadcasts
|
2700
|
+
# assert_no_broadcasts 'messages'
|
2701
|
+
# ActionCable.server.broadcast 'messages', { text: 'hi' }
|
2702
|
+
# assert_broadcasts 'messages', 1
|
2703
|
+
# end
|
2704
|
+
#
|
2705
|
+
# If a block is passed, that block should not cause any message to be sent.
|
2706
|
+
#
|
2707
|
+
# def test_broadcasts_again
|
2708
|
+
# assert_no_broadcasts 'messages' do
|
2709
|
+
# # No job messages should be sent from this block
|
2710
|
+
# end
|
2711
|
+
# end
|
2712
|
+
#
|
2713
|
+
# Note: This assertion is simply a shortcut for:
|
2714
|
+
#
|
2715
|
+
# assert_broadcasts 'messages', 0, &block
|
2716
|
+
#
|
2717
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:78
|
2718
|
+
def assert_no_broadcasts(stream, &block); end
|
2719
|
+
|
2720
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:6
|
2721
|
+
def before_setup; end
|
2722
|
+
|
2723
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:126
|
2724
|
+
def broadcasts(*_arg0, &_arg1); end
|
2725
|
+
|
2726
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:126
|
2727
|
+
def clear_messages(*_arg0, &_arg1); end
|
2728
|
+
|
2729
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:122
|
2730
|
+
def pubsub_adapter; end
|
2731
|
+
|
2732
|
+
private
|
2733
|
+
|
2734
|
+
# source://actioncable-7.0.3.1/lib/action_cable/test_helper.rb:129
|
2735
|
+
def broadcasts_size(channel); end
|
2736
|
+
end
|
2737
|
+
|
2738
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:9
|
2739
|
+
module ActionCable::VERSION; end
|
2740
|
+
|
2741
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:10
|
2742
|
+
ActionCable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
|
2743
|
+
|
2744
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:11
|
2745
|
+
ActionCable::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
|
2746
|
+
|
2747
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:13
|
2748
|
+
ActionCable::VERSION::PRE = T.let(T.unsafe(nil), String)
|
2749
|
+
|
2750
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:15
|
2751
|
+
ActionCable::VERSION::STRING = T.let(T.unsafe(nil), String)
|
2752
|
+
|
2753
|
+
# source://actioncable-7.0.3.1/lib/action_cable/gem_version.rb:12
|
2754
|
+
ActionCable::VERSION::TINY = T.let(T.unsafe(nil), Integer)
|