-
Notifications
You must be signed in to change notification settings - Fork 387
Java WebSockets and SocketIO SSL seem incompatible on android #60
Comments
Thanks a lot for the solution. I was struggling for weeks because of this issue. |
Brilliant! Thanks @z4ce, I had the same issue and this appears to have solved it. |
An important note this solution: It only works on Android 4.2+ I'm not really sure why. If someone figures this out, let me know, please. |
Changes taken from Gottox#60
Did we ever figure out a fix for why this wasn't working on anything less than Android 4.2+? I would like to help find a solution to this if possible. |
Dude, thank you a lot! It works like a charm!! |
It worked for me as well. Perhaps this fix for WebsocketTransport.java should be inside the GitHub repo as well? Saves some time downloading / editing the source files. Thank you! Been working on this for the past six hours. |
it doesn't work for me, I'm using android 4.4.4. Is there any change in the Android 4.4? |
+1 for 4.4.4. |
I found that updating the Java-WebSocket to the latest and making the modifications suggested in robertoandrade's comment worked for Android 5.0.1+ devices (LG Nexus 5, Asus Nexus 7), but crashed with an NPE on earlier versions of Android (Samsung Galaxy S4 - v4.4.2, Samsung Galaxy Nexus - v4.2.1, Samsung Nexus S - v4.0.4, Samsung GT-I5500 - v2.3.7). The only workaround that I could find at this time is to replace |
Just a small update on this. HarmonyJSSE only looks to be supported up to API level 19, so not Lollipop and above. To confirm, on a Nexus 4 Lollipop:
Update: There appear to be another issue with the java-websocket library dependency with API 21 that has possibly been fixed in 1.3. See: TooTallNate/Java-WebSocket#293 |
Hi, I'm new to android, I'm getting the the following error, 06-04 12:13:33.040: W/System.err(17338): SocketIOException: Error while handshaking at .IOConnection.handshake(IOConnection.java:327) As suggested i'm using socketIO server version 0.9.16, and folk of /Grantoo/socket.io-java-client The same code is working for http domain, but its not working for https and SSL protocols. Please help solving this. |
I was getting silent failures whenever using SSL on android. I ended up install the source for this project and the Java WebSockets project and debugged where the exception was occuring. This was the exception causing it to not work
"org.apache.harmony.xnet.provider.jsse.OpenSSLSessionImpl cannot be cast to org.apache.harmony.xnet.provider.jsse.SSLSessionImpl"
It turns out for some reason the SSLContext SSLContext.getDefault works great for socket.io and it can negotiate just fine. But when it calls the parent "transport" it does not work because the parent needs the "HarmonyJSSE" provider and not the OpenSSL provider. I don't have enough knowledge of how android SSL works to really make sense of why this is, but it definitely is the case.
I was able to get the negotiation and transport working by doing the following:
Then I had to edit the WebsocketTransport as follows:
This problem might require some coordination with the upstream library.
The text was updated successfully, but these errors were encountered: