-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with liveview socket #36
Comments
Disclaimer: I've never used Phoenix. But as far as I understand, yes, outside of the Plug pipeline you have to manually call Glad this little library helped! |
Ok great. Appreciate the library and feedback. It works great while hosting our app on Gigalixir. |
@xpressivecode A bit of drive-by code review I thought of while walking my dog. 😅 While calling So I think it'd be simpler to use the headers = get_connect_info(socket, :x_headers)
remote_ip = RemoteIp.from(headers)
human_friendly_remote_ip =
if remote_ip do
:inet.ntoa(remote_ip) |> to_string()
else
"unknown"
end
socket = socket |> assign(:remote_ip, human_friendly_remote_ip) Figured I should mention it just in case. :) |
@ajvondrak I'm really sorry. I saw the notification come in, meant to reply and things kicked off at work. I really appreciate you taking the added time to follow up and provide a better solution. We'll be updating to use this implementation. |
@xpressivecode No worries, I know how that goes! Glad I could help either way. :) |
I've added the plug, but I'm unsure how to access the remote_ip from a liveview socket?
So for now I've settled on the following
Is there a better implementation pattern?
Thanks either way, this lib helped a lot.
The text was updated successfully, but these errors were encountered: