delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

wss connection issue with tubesock #101

Closed daupawar closed 7 years ago

daupawar commented 8 years ago

When i was trying to connect Secure layer with wss://myurl/websocket i am getting Meteor Exception error while creating secure socket error Same url works with meteor ios lib in ios so i replaced tubesock code with nv-websocket-client and now its working fine

ocram commented 8 years ago

Thanks for your report!

Can you share the URL? Or some other URL where this happens?

Is there any way you can print the complete stack trace and post it here?

Or are you trying to use a self-signed certificate? https://github.com/delight-im/Android-DDP/issues/100

ocram commented 8 years ago

It seemed this was due to Server Name Indication (SNI) as part of SSL/TLS, which may not be supported by our WebSocket library. Can someone verify?

daupawar commented 8 years ago

SNI is not an issue, 'nv-websocket-client' works well where 'tubesock' can't

ocram commented 8 years ago

Yes, presumably because "nv-websocket-client" does support SNI :)

We'll offer a version of this library with "nv-websocket-client" instead of "TubeSock" in a separate branch so that everybody can test it and see if it works better.

musriabhijit commented 8 years ago

com.firebase.tubesock.WebSocketException: error while creating secure socket i am getting this exception while connecting my websocket so what is the solution

daupawar commented 8 years ago

@musriabhijit please send your connection URL and code

musriabhijit commented 8 years ago

in the sample code i am just changing my web socket with http://ec2-50-17-2-110.compute-1.amazonaws.com:3000/ so this is my url

ocram commented 8 years ago

@musriabhijit Can you try changing http:// to ws:// at the beginning? And are you sure you don't need /websocket instead of / at the end? By the way, I can't connect to your site using this online tool so there might be some problem on your server.

musriabhijit commented 8 years ago

if i use wss it is going to exception and disconnected so what is the solution for this

musriabhijit commented 7 years ago

@ daupawar i am also facing the same Issue as mention by you at first When i was trying to connect Secure layer with wss://myurl/websocket i am getting Meteor Exception error while creating secure socket error Same url works with meteor ios lib in ios so i replaced tubesock code with nv-websocket-client and now its working fine so how you solved the problem and if you made the library changes to the current library can you send that library

daupawar commented 7 years ago

@musriabhijit I haven't made library, i downloaded whole code and changed build.gradle for nv-websocket. then i changed meteor.java file.

musriabhijit commented 7 years ago

you have changed the code in meteor.java file right can you send me that file so that i can use the same code i don't know how the meteor works in the back end to connect to meteor so i need the help from you if you send me the meteor.java file then it will be great help

daupawar commented 7 years ago

@musriabhijit send me your mail id

musriabhijit commented 7 years ago

@daupawar musri.abhijit007@gmail.com

ocram commented 7 years ago

To sum up, we've found out that TubeSock, which has been the underlying WebSocket component for this library, doesn't seem to support Server Name Indication (SNI) or self-signed certificates with SSL/TLS.

Thus we decided it may be a good idea to switch to nv-websocket-client, which also proved to have more active support. Since we heard about it initially, that library has always been a promising alternative, but I wanted to watch it a little longer to see whether support for it continues.

Now, let's finally attempt the switch between these two libraries. I've started the transition in https://github.com/delight-im/Android-DDP/commit/ec334366059f030c3ff73b66f154dcf5f333359c but this is an early draft. There may be bugs that we'll have to fix. There are many new possibilities for configuration and customization that we'll be able to use. So that implementation has to be completed and perhaps improved in some existing parts.

If anybody has feedback on this implementation, especially given that some of you have already done this change in their private forks, I'd love to hear what you think.

In order to try the new implementation, it will be sufficient to replace the version v3.1.2 in your Gradle dependency with the following commit hash:

ec334366059f030c3ff73b66f154dcf5f333359c

Should you still be interested in this issue, @daupawar, @musriabhijit, @MathiasHH, @elbow, @vlasky, @isdzulqor and anybody else, your feedback will be much appreciated. Thanks!

daupawar commented 7 years ago

@ocram that would be great. I have been using 'nv-websocket-client' in forked code from last 3 months, I tried with different urls ('wss' and 'ws') and haven't found any issue with it.

ocram commented 7 years ago

Oh, let's keep this open for now :)

As explained above, I have changed the WebSocket library in this project as well. So hopefully, everyone can soon use this repository instead of their private forks again.

For that to happen, I just need some feedback on the implementation. My previous comment explains how the implementation can be tested with your app.

Since some of you have created their private forks, I'd also love to hear about how your code is different from https://github.com/delight-im/Android-DDP/commit/ec334366059f030c3ff73b66f154dcf5f333359c and whether we need some more changes for everything to work correctly, including SSL/TLS with SNI and self-signed certificates.

ocram commented 7 years ago

Again, the following is the dependency for those who would like to test this library with the alternative WebSocket library that may replace the existing one:

compile 'com.github.delight-im:Android-DDP:ec334366059f030c3ff73b66f154dcf5f333359c'
shaiamir commented 7 years ago

ws and wss works for me. Thanks!

ocram commented 7 years ago

@shaiamir Thanks! This is now in the main branch and in the latest release:

https://github.com/delight-im/Android-DDP/commit/c4d72267c5c0a9abe7931cc9c4b1255d8c909da9

deadjdona commented 7 years ago

Good day.

Can you update nv-websocket-client to latest version, please?

najeebullahshah commented 6 years ago

I am using a wss one with the following dependency:

compile 'com.github.delight-im:Android-DDP:ec334366059f030c3ff73b66f154dcf5f333359c'

and getting the following exception:

com.neovisionaries.ws.client.WebSocketException: Failed to get the input stream of the raw socket: Connection closed by peer