module Anycablebility::RPC

Runs AnyCable RPC server in the background

Attributes

running[RW]

Public Class Methods

running?() click to toggle source
# File lib/anycablebility/rpc.rb, line 31
def running?
  Anycable::Server.grpc_server&.running_state == :running
end
start() click to toggle source
# File lib/anycablebility/rpc.rb, line 14
def start
  Anycable.logger.debug "Starting RPC server ..."

  @thread = Thread.new { Anycable::Server.start }
  @thread.abort_on_exception = true

  wait(2) { running? }

  Anycable.logger.debug "RPC server started"
end
stop() click to toggle source
# File lib/anycablebility/rpc.rb, line 25
def stop
  return unless running?

  Anycable::Server.grpc_server.stop
end