title: Java/Android websocket cannot connect to Spark websocket service but JavaScript can
body: <p>I want to connect to an open Spark websocket server. For me, this server is located at ws://192.168.56.1:4567/chat/. When I try connecting to it using JavaScript running on the computer, it works:</p>
  
  <pre><code>var websocket = new WebSocket("ws://192.168.56.1:4567/chat/");
  </code></pre>
  
  <p>This code successfully connects to the websocket. On Android using java-websocket, this snippet looks like this:</p>
  
  <pre><code>val client = Client(URI("ws://192.168.56.1:4567/chat/"))
  </code></pre>
  
  <p>I use Kotlin, the equivalent Java Code is</p>
  
  <pre><code>Client client = new Client(new URI("ws://192.168.56.1:4567/chat/"));
  </code></pre>
  
  <p>where Client is a class extending WebSocketClient. When I try to connect to the websocket, it simply does not work and times out as if this websocket didn't exist at all. I do have INTERNET enabled in my manifest file:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;application
  [...]
  </code></pre>
  
  <p>and I tried to ping Google and that worked, so I really don't know what causes this. Thank you for any help!</p>