Android-DDP icon indicating copy to clipboard operation
Android-DDP copied to clipboard

wss error handshake

Open mi4uu opened this issue 7 years ago • 10 comments

Hi, I have big problem. I cant connect on wss. this is what i got on onException:

meteor: exception: java.lang.Exception: com.neovisionaries.ws.client.WebSocketException: Failed to get the input stream of the raw socket: Handshake failed

and this is how I'm connecting to my server:

    mMeteor = new Meteor(this, "wss://beholder.com.pl/websocket");

    // register the callback that will handle events and receive messages
    mMeteor.addCallback(this);

    // establish the connection
    mMeteor.connect();

best Regards Mike

mi4uu avatar Nov 22 '17 02:11 mi4uu

Failed to get the input stream of the raw socket: Handshake failed

I think the message of this com.neovisionaries.ws.client.WebSocketException has been pretty clear, especially the last part. The question is then why the handshake has failed.

Your sequence of calls and your backend URL look good, and the server’s response is fine too – at least temporarily, perhaps it was different back when this failed.

So if you connect using ws instead wss, everything works without problems? Can you check which Meteor version you’re using?

ocram avatar Nov 24 '17 07:11 ocram

Hi, if I try on the other android device it works fine some other device send me handshake fail

theshook avatar Feb 20 '18 17:02 theshook

@theshook What are the exact Android versions of the respective devices?

ocram avatar Feb 20 '18 18:02 ocram

If I try on samsung s5 lollipop OS then the error will come out, but if I try on the zenfone3 Oreo there is no error

theshook avatar Feb 21 '18 09:02 theshook

@theshook That might mean Android 5 with its TLS stack is too old. Can you try Android 6 or 7 perhaps? Apart from that, can you check what this tool does say for Android 5 vs Android 7 in the “Handshake Simulation” section? What is the provider of your TLS certificate? Could it be that Android 5 does not trust the certificate while Android 8 does?

ocram avatar Feb 21 '18 15:02 ocram

hi! I'm using meteor-now to deploy my application. yes, I tried on other android version and it works fine android 7. Is there other solution regarding my problem? meteor-now uses https://zeit.co/ and if you deploy a website there for free it ends with ".now.sh" by the way I used the tool that you include in your comment and here are the results image

theshook avatar Feb 23 '18 16:02 theshook

image

theshook avatar Feb 23 '18 16:02 theshook

@theshook Thanks! It seems this is because the server does not support TLS 1.0 or because it lacks the cipher suites that Android 5 supports. Maybe this helps. Alternatively, you could fork the library and its sample and check if you can connect if you modify WebSocketFactory and its SSL/TLS settings as described here.

ocram avatar Feb 24 '18 00:02 ocram

has any one found the solution. i am getting the same error. i am trying app on nexus 5 having OS 6.0 marshmallow

rizwan321 avatar Mar 14 '18 11:03 rizwan321

There’s certainly one thing you could all do in order to help solve this issue for everybody:

TakahikoKawasaki/nv-websocket-client is the underlying WebSocket library that we’re using. You could create a new Android project, include that WebSocket library, and build a basic and very simple Activity that connects to your server using wss. You should specifically try versions 2.3 and 1.31 of that library. I’m afraid there’s nothing more we can do here. Sorry!

ocram avatar Mar 14 '18 14:03 ocram