Class: AnyCable::RackServer::RPC::Client
- Inherits:
-
Object
- Object
- AnyCable::RackServer::RPC::Client
- Defined in:
- lib/anycable/rack-server/rpc/client.rb
Instance Attribute Summary collapse
-
#stub ⇒ Object
readonly
Returns the value of attribute stub.
Instance Method Summary collapse
- #command(command:, identifier:, connection_identifiers:, data:) ⇒ Object
- #connect(headers:, path:) ⇒ Object
- #disconnect(identifiers:, subscriptions:, headers:, path:) ⇒ Object
-
#initialize(host) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(host) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/anycable/rack-server/rpc/client.rb', line 11 def initialize(host) @stub = AnyCable::RPC::Service.rpc_stub_class.new(host, :this_channel_is_insecure) end |
Instance Attribute Details
#stub ⇒ Object (readonly)
Returns the value of attribute stub.
9 10 11 |
# File 'lib/anycable/rack-server/rpc/client.rb', line 9 def stub @stub end |
Instance Method Details
#command(command:, identifier:, connection_identifiers:, data:) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/anycable/rack-server/rpc/client.rb', line 20 def command(command:, identifier:, connection_identifiers:, data:) = CommandMessage.new( command: command, identifier: identifier, connection_identifiers: connection_identifiers, data: data ) stub.command() end |
#connect(headers:, path:) ⇒ Object
15 16 17 18 |
# File 'lib/anycable/rack-server/rpc/client.rb', line 15 def connect(headers:, path:) request = ConnectionRequest.new(headers: headers, path: path) stub.connect(request) end |
#disconnect(identifiers:, subscriptions:, headers:, path:) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/anycable/rack-server/rpc/client.rb', line 30 def disconnect(identifiers:, subscriptions:, headers:, path:) request = DisconnectRequest.new( identifiers: identifiers, subscriptions: subscriptions, headers: headers, path: path ) stub.disconnect(request) end |