Relative Content

Tag Archive for javawebsocket

How to know the URL of a websocket client request?

I have a websocket server deployed on localhost in the user PC. Some website in foo.domain.com is calling the websocket this way: wss://localhost/sign, the websocket server processes the information and returns the data to the website. Everything is working fine, but I want to know if I can read the URL of the website who is calling the websocket. I want to obtain foo.domain.com in the websocket server. Right know I read a variable session.getRequestURI().getHost() and I always get 127.0.0.1, I think this is because the website code is running locally in Javascript in the same machine of the user and where is installed the websocket server. The websocket server is developed with Java and this is part of my code.