How to Retrieve IP address on Meteorjs?. Any package is there?. Please advise.
You can use the mizzao:user-status
package to get the IP address of user. It is the standard package used to get such information about client-side user connection and status.
Install it with: meteor add mizzao:user-status
Then you can use the UserStatus.connections
(in-memory) collection to get information for all connections on the server, in the following fields:
userId
: the user id, if the connection is authenticated. ipAddr
:
the remote address of the connection. A user logged in from different places will have one document per connection. (This is the field you need)One thing, from their documentation on Atmosphere site:
Note that to read client IP addresses properly, you must set the HTTP_FORWARDED_COUNT environment variable for your app, and make sure that IP address headers are forwarded for any reverse proxy installed in front of the app. See the Meteor docs on this for more details.