Class: Protobuf::Rpc::Socket::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/protobuf/rpc/socket/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Server

Returns a new instance of Server.



6
7
8
# File 'lib/protobuf/rpc/socket/server.rb', line 6

def initialize(options)
  @options = options
end

Instance Method Details

#run(supervision: true) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/protobuf/rpc/socket/server.rb', line 10

def run(supervision: true)
  if supervision
    config = ::Celluloid::Supervision::Configuration.new
    config.add(type: Protobuf::Rpc::Socket::Runner, as: :rpc, args: @options)
  else
    Protobuf::Rpc::Socket::Runner.new(@options)
  end

  begin
    loop { sleep 60 }
  rescue Interrupt
    exit
  end
end