jakartaee / websocket

Jakarta WebSocket
https://projects.eclipse.org/projects/ee4j.websocket
Other
61 stars 43 forks source link

Add a method to retrieve the remote address #255

Open lapo-luchini opened 6 years ago

lapo-luchini commented 6 years ago

AFAICT it is currently impossible (except using reflection to access specific implementation’s private properties) to retrieve the connecting user’s IP address. Just as in ordinary HTTP connections, it could be useful to know that. To avoid changing the APIs I guess it could be added to the existing session user properties (as done e.g. by Getty Jetty), but any standard way to obtain that would be useful, really, even adding it to HandshakeRequest and accessing in the way suggested in #218.

joakime commented 6 years ago

Note: The Jetty project exposes the local and remote InetAdddress (along with other handshake values) in the Session.userProperties as well.

Under the names javax.websocket.endpoint.remoteAddress and javax.websocket.endpoint.localAddress.

lapo-luchini commented 6 years ago

Uh, yes, I wrote "getty" but I meant "jetty". 😇