require "socket"

# connect to socket
sock = UNIXSocket.new("/tmp/myapp.sock")

loop do
  print "Enter command [help, start, run]: "

  # get string from terminal input
  string = gets.not_nil!.to_s

  if string == "q"
    break
  end

  # send string to server
  sock.puts "#{string}\n"

  # get response from server & print
  response = sock.gets
  puts response
end

sock.close
