Class: Anyt::RPC
- Inherits:
-
Object
- Object
- Anyt::RPC
- Defined in:
- lib/anyt/rpc.rb
Overview
Runs AnyCable RPC server in the background
Instance Attribute Summary collapse
-
#running ⇒ Object
Returns the value of attribute running.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
- #start ⇒ Object
-
#stop ⇒ Object
rubocop: enable Metrics/AbcSize,Metrics/MethodLength.
Instance Attribute Details
#running ⇒ Object
Returns the value of attribute running.
12 13 14 |
# File 'lib/anyt/rpc.rb', line 12 def running @running end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
13 14 15 |
# File 'lib/anyt/rpc.rb', line 13 def server @server end |
Instance Method Details
#start ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/anyt/rpc.rb', line 15 def start AnyCable.logger.debug "Starting RPC server ..." AnyCable.server_callbacks.each(&:call) @server = AnyCable::GRPC::Server.new( host: AnyCable.config.rpc_host, **AnyCable.config.to_grpc_params ) if defined?(::AnyCable::Middlewares::EnvSid) AnyCable.middleware.use(::AnyCable::Middlewares::EnvSid) end AnyCable.middleware.freeze server.start AnyCable.logger.debug "RPC server started" end |
#stop ⇒ Object
rubocop: enable Metrics/AbcSize,Metrics/MethodLength
37 38 39 |
# File 'lib/anyt/rpc.rb', line 37 def stop server&.stop end |