class Evesync::IPC::Server

Server is a DRb object, using :port and :proxy object to handle requests.

Params

:proxy

all methods go to this object

:port

defines which port which port connect to

Example:

# Setup the server
server = Evesync::IPC::Server(
  :port => '8089',
  :proxy => SomeHandler.new
)
...
server.start # now it starts recieving requests
...
server.stop # main thread exits

TODO:

* Handle blocks

Attributes

uri[R]

Public Class Methods

new(params) click to toggle source
# File lib/evesync/ipc/server.rb, line 37
def initialize(params)
  check_params_provided(params, %i[port proxy])
  port = get_port params
  ip = params[:ip] || 'localhost'
  @uri = "druby://#{ip}:#{port}"
  @proxy = params[:proxy]
end

Public Instance Methods

start() click to toggle source
# File lib/evesync/ipc/server.rb, line 45
def start
  DRb.start_service(@uri, @proxy)
  self
end
stop() click to toggle source
# File lib/evesync/ipc/server.rb, line 50
def stop
  DRb.stop_service
  self
end