Closed ocram closed 8 years ago
Thank you very much!
My issue with that library is that it isn't as extensively tested as the original Autobahn library. So I don't really want to switch to it here in the main repository.
But we'll leave the link to your fork here as the reference for all developers who need WSS (TLS) support today. Thank you!
By the way, Autobahn even has a TLS branch. But that one does not pass their extensive test suite yet, and unfortunately it hasn't been updated in the past three years.
We may also switch to TubeSock instead, which is based on the old Weberknecht library.
Happy to find this thread, just to note that I also need TLS support for my application.
Many thanks for your effort on this library.
Hiyas, I have successfully added SSL support to Android-DDP by replacing Autobahn with Takahiko Kawasaki's nv-websocket-client.
It has been tested successfully in Android 4.4 and upwards. It may work in earlier versions, but I haven't needed to use any Android devices with those old versions. I will share my code with Marco and see what he thinks.
how to sett up server for this library, I made an android native app with this library and I use meteor for my web service. I dont remove insecure package and autopublish package. so I can Insert, delete and update without subscribe or call the method in client. but my problem is I can not connect to my localhost. I use genymotion for the android emulator. Any one can Help me, please,,, Thank you for this amazing library here is my code https://ideone.com/pXzJW8
isdzulqor - I see one obvious error in your code. Your URL is missing "/websocket".
Instead of:
mMeteor = new Meteor(getApplicationContext(), "ws://192.168.56.1:3000");
It should be:
mMeteor = new Meteor(getApplicationContext(), "ws://192.168.56.1:3000/websocket");
@vlasky Thank you man, it works.. I've tried many times, i've tried restivus too, but it's still not working,, now you save my live :D but I am still wondering about, is it possible to upload file through ddp with this library,. like picture, video etc.. any way thank you so much for this amazing library too :) ,,
Experimental support for WSS (WebSocket over SSL/TLS) is now available on a separate branch :)
Please get the latest JAR there and test WSS support with your app. Do not use it in production yet.
You'll have to remove the two parameters from your onDisconnect(...)
callbacks and the minimum API level has been raised from 8
(Android 2.2) to 9
(Android 2.3).
As soon as everything has been tested and bugs have been fixed, we'll integrate this into the main branch.
Thanks for your patience, @elbow and @vlasky!
@vlasky I've taken a look at your code -- it's good and we really appreciate your work. But we feel that TubeSock is a superior WebSocket library so we'll use that instead of nv-websocket-client.
OK, but I wouldn't poo-poo nv-websocket-client just yet - the author is actively and enthusiastically maintaining that package.
Also, I recently asked him to add support for websocket compression using permessage deflate and his response was encouraging:
https://github.com/TakahikoKawasaki/nv-websocket-client/issues/15
I presume you are aware that Meteor 1.2 recently introduced support for this. If it were supported in the DDP client, it would greatly reduce the amount of data transferred over the internet connection - very useful when clients are communicating over cellular data networks that have data usage quotas.
TubeSock doesn't appear to support this and there is no roadmap on TubeSock's page that would indicate plans for future support.
@vlasky Thanks for your thoughts!
We've worked with seven of the major WebSocket libraries that are available for Java/Android in the past. Judging stability, ease of use and overall quality, we would definitely rank those as follows:
In fact, we've even built this WSS implementation with all of (1), (3), (4) and (5). TubeSock turned out to be the best library, mainly because it's super stable, with nv-websocket-client being a close contender.
What also speaks for TubeSock is:
So TubeSock is definitely what this library will be based on, starting with the next release.
But this may change again in the future, and we'll watch nv-websocket-client and the others closely.
Until then, you can of course keep using your forked version of this library that uses nv-websocket-client.
Implemented in https://github.com/delight-im/Android-DDP/commit/61109f1522f74b11a61bac48b40376ec18df6885 and 8 parent commits, and merged into the main branch :)
Takahiko Kawasaki, the author of the websocket library nv-websocket-client, has just announced that he has implemented support for permessage deflate. I will be testing it out in my forked version of Android-DDP.
https://github.com/TakahikoKawasaki/nv-websocket-client/issues/15
@vlasky Thanks, impressive speed! As I said, we'll definitely watch that WebSocket library closely. In the meantime, developers who need support for "permessage-deflate" can probably get good support with your forked version, as soon as it's ready.
@mwaclawek @vlasky
Comments from the author of nv-websocket-client (me) after reading the source code of TubeSock.
WebSocket
classSec-WebSocket-Extensions
). Before implementing permessage-deflate
, TubeSock has to implement a base mechanism to handle extensions.Map<String, String>
. This means headers having the same name cannot be specified multiple times. It should be Map<String, List<String>>
.closeSocket()
closes socket
without waiting for receiver
to finish its task. It will cause IOException
in receiver
. So, in most cases, a close operation will end with an error.SSLSocketFactory
or SSLContext
.HashMap<String, String>()
. But it should be TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER)
.socket.getInputStream()
with BufferedInputStream
. This will cause a performance issue.socket.getOutputStream()
with BufferedOutputStream
. This will cause a performance issue.socket.close()
in closeSocket()
throws an IOException
, WebSocketEventHandler.onClose()
is not called.WebSocket
instance can hold is only one.WebSocketHandshake
classUpgrade
header is too simple. To be extact, its implementation is wrong. It does not take into account the possibility that multiple elements may be listed in Upgrade
header.Connection
header has the same problem as above.Sec-WebSocket-Accept
header. This is a violation against RFC 6455. See Page .19 of RFC 6455 for details.Sec-WebSocket-Extensions
header.Sec-WebSocket-Protocol
header.WebSocketReceiver
classstopit()
just executes stop = true
without any synchronization. Also, there is no interrupt()
call for itself. So, read
operation will block forever. But, it stops blocking thanks to the wrong implementation of WebSocket.closeSocket()
.WebSocketEventHandler
interfaceWebSocket
instance which the event handler is registered into.onClose()
cannot know the reason code and the reason message of the close event.onError()
cannot know the context of the error.MessageBuilderFactory
TextBuilder
implementation is wrong. Although its comment refers to a possibility that bytes of multi-byte UTF-8 characters may be split across websocket frames, TextBuilder.appendBytes(bytes[])
tries to construct a UTF-8 string per frame. This is a big bug.Whether a library is used by many people, maintained by a big company, already deployed in many commercial environments, does not necessarily assure its quality. For example, Adobe Flash.
From my viewpoint, the quality of TubeSock is beginners' level. Don't believe rumors about software naively, but compare source codes when you select one from among multiple choices.
See also "Which WebSocket library to use in Android app?" (StackOverflow).
@TakahikoKawasaki Thank you very much for taking the time to look at TubeSock's source code and advertising your library. Just as rumors (whatsoever) are no good indicator of a library's quality, simply adding large quantities of features at a rapid pace is not an indicator of quality, either. But as I said, we're watching your library, which has emerged as an interesting contender, closely, and may very well do the switch in the near future.
The Autobahn library doesn't have support for the
wss
protocol so either switch to another library or wait until the feature is added