python-hyper / wsproto

Sans-IO WebSocket protocol implementation
https://wsproto.readthedocs.io/
MIT License
261 stars 38 forks source link

Remote IP Address #164

Closed NoSuck closed 3 years ago

NoSuck commented 3 years ago

Would it be possible for wsproto to provide a remote client's address? If not, are there recommended workarounds? Thank you.

njsmith commented 3 years ago

wsproto doesn't do any networking, so it can't do anything with IP addresses. This is something you'd need to handle in your networking layer. (E.g., by saving the address returned by sock.accept().)

NoSuck commented 3 years ago

I see. Thank you for confirming that I was barking up the wrong tree.

This is a nice software library, by the way--much better than that other library that basically forces your entire application to use asyncio. Thank you for sharing it.

EDIT: Wouldn't socket.accept() return localhost in most server setups, though?