Web Socket Connection failed from Android Client Web Socket Connection failed from Android Client android android

Web Socket Connection failed from Android Client


I just found another simple way to get rid of this issue.

Change following line

mWebSocketClient = new WebSocketClient(uri){

to

mWebSocketClient = new WebSocketClient(uri, new Draft_17()){

I found the hint in my Serverlogs which said:

User Agent: [unset] requested WebSocket version [8], Jetty supports version: [13]

As you can see in the link below, Version 8 is Draft_10, Version 13 is Draft_17.

Link to supported Websocket-Versions


I found the issue with this.

Actually the problem with the Java provided web socket jar file.

Instead of that I have used the Autobahn (Android Specific Web Socket Open Source https://github.com/tavendo/AutobahnAndroid).

Now am able to connect with the web socket server.