class Del::SocketServer

A Socket server for client/server communication overs a UNIX socket.

Public Class Methods

new(socket_file:) click to toggle source
# File lib/del/socket_server.rb, line 7
def initialize(socket_file:)
  @connection = SocketConnection.new(path: socket_file)
end

Public Instance Methods

run(robot) click to toggle source
# File lib/del/socket_server.rb, line 11
def run(robot)
  loop do
    @connection.on_receive do |socket|
      line = socket.readline
      Del.logger.debug(line)
      socket.write(robot.execute(JSON.parse(line)))
    end
  end
end