Sha256: 9dd282e7148372ea188ef6751add528b3eea911fd1dd910952458082c6e53759

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hara-0.3.0 lib/hara/client_interaction.rb