我最近在Heroku上使用Express和socket.io託管了我的第一個Node應用程序,並且需要查找客戶端的IP地址。到目前爲止,我已經嘗試過socket.manager.handshaken[socket.id].address
,socket.handshake.address
和socket.connection.address
,它們都沒有給出正確的地址。如何將客戶端的正確IP地址獲取到Heroku上託管的Node socket.io應用程序中?
應用:http://nes-chat.herokuapp.com/(還包含一個鏈接到GitHub庫)
要查看已連接的用戶的IP地址:http://nes-chat.herokuapp.com/users
任何人都知道問題是什麼?
相關:http://stackoverflow.com/questions/6458083/socket-io-get-clients-ip-address – nha