module Hara module ClientInteraction attr_reader :socket, :handshake, :client_ip, :client_port def socket_setup handshake, socket @handshake = handshake @socket = socket @client_port, @client_ip = Socket.unpack_sockaddr_in(socket.get_peername) #to get ip address of user end # get client headers def headers handshake.headers_downcased end # send msg to client def send_msg msg socket.send msg end # close connection def close code = nil, body = nil @socket.close code, body end end end