gusavila92 / java-android-websocket-client

Java/Android WebSocket Client
Apache License 2.0
148 stars 40 forks source link

Connect to defined port with WSS : Trying to connect using local(private) IP #10

Closed ejChathuranga closed 5 years ago

ejChathuranga commented 6 years ago

As docx says no need to add any additional headers for WSS request. I tried to connect with WSS and defined the port. ex: uri = new URI("wss://develop-xxxxxx.xxxx.pl:9050/websocket");

Response bring an exception telling that failed to connect.... java.net.SocketTimeoutException: failed to connect to develop-xxxxxx.xxxx.pl/##.###.##.### (port 9050) from /###.###.#.### (port 42827) after 10000ms

In this exception, from /###.###.#.### (port 42827) after 10000ms, the hash code includes my local(private) IP. I think it should connect via public IP of my network.

Is there any method to set manually port and where I missed?

gusavila92 commented 6 years ago

You can try connecting to the WebSocket server using this Chrome plugin https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en

If the connection is successful, there must be an error in the library, if not, you should verify that the specified port is ready to receive connection from the Internet.

The string is OK, there's no need to manually specify a port. And the IP is good as well, your NAT should be responsible to translate the private IP to the public one.