Skip to content

Unable to use remote_ip method #141

Open
@IMcPwn

Description

@IMcPwn

Here's an example WebSocket connection:

[31] pry(main)> wss.getWsList[0]
=> #<EventMachine::WebSocket::Connection:0x00000001f35150
 @close_timeout=nil,
 @debug=false,
 @handler=
  #<EventMachine::WebSocket::Handler13:0x00000001f39ef8 @application_data_buffer="", @close_timer=nil, @connection=#<EventMachine::WebSocket::Connection:0x00000001f35150 ...>, @data="", @debug=false, @frame_type=nil, @state=:connected>,
 @handshake=nil,
 @onclose=#<Proc:0x00000001f36af0@/[REDACTED]>,
 @onerror=#<Proc:0x00000001f366e0@/[REDACTED]>,
 @onmessage=#<Proc:0x00000001f367a8@/[REDACTED]>,
 @onopen=#<Proc:0x00000001f36b90@/[REDACTED]>,
 @options={:host=>"0.0.0.0", :port=>443, :secure=>true, :tls_options=>{:private_key_file=>"privkey.pem", :cert_chain_file=>"cert.pem"}},
 @secure=true,
 @secure_proxy=false,
 @signature=3,
 @tls_options={:private_key_file=>"privkey.pem", :cert_chain_file=>"cert.pem"}>

I want to get the IP address of the remote host, so I use remote_ip like in commit 705c9f1.

[33] pry(main)> wss.getWsList[0].remote_ip
NoMethodError: undefined method `remote_ip' for #<EventMachine::WebSocket::Connection:0x00000001f35150>
from (pry):52:in `cmdLine'

However if I use the code inside of the remote_ip method I get this:

[34] pry(main)> wss.getWsList[0].get_peername[2,6].unpack('nC4')[1..4].join('.')
=> "[REDACTED_IP]"

Why wouldn't I have the remote_ip method? I'm using version 0.5.1 of the gem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions