Module: Anyt::RPC
- Defined in:
- lib/anyt/rpc.rb
Overview
Runs AnyCable RPC server in the background
Class Attribute Summary collapse
-
.running ⇒ Object
Returns the value of attribute running.
Class Method Summary collapse
-
.start ⇒ Object
rubocop: disable Metrics/AbcSize,Metrics/MethodLength.
-
.stop ⇒ Object
rubocop: enable Metrics/AbcSize,Metrics/MethodLength.
Class Attribute Details
.running ⇒ Object
Returns the value of attribute running.
13 14 15 |
# File 'lib/anyt/rpc.rb', line 13 def running @running end |
Class Method Details
.start ⇒ Object
rubocop: disable Metrics/AbcSize,Metrics/MethodLength
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/anyt/rpc.rb', line 16 def start ActionCable.server.config.cable = { "adapter" => "any_cable" } Rails.application.initialize! AnyCable.logger.debug "Starting RPC server ..." AnyCable.server_callbacks.each(&:call) @server = AnyCable::Server.new( host: AnyCable.config.rpc_host, **AnyCable.config.to_grpc_params, interceptors: AnyCable.middleware.to_a ) AnyCable.middleware.freeze @server.start AnyCable.logger.debug "RPC server started" end |
.stop ⇒ Object
rubocop: enable Metrics/AbcSize,Metrics/MethodLength
38 39 40 |
# File 'lib/anyt/rpc.rb', line 38 def stop @server.stop end |