New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: is it possible to use rsocket-java on Android as the client? #375
Comments
We (Facebook) use rsocket-cpp on Android and iOS talking to rsocket-cpp on the server. rsocket-java should work (netty seems to work) but I don't think it's been tried before so might be some friction. |
@lexs Sounds cool, I think I'll try rsocket-cpp. Thanks. |
@NexZhu I expect if you get rsocket-java working with Netty dependencies it will be simpler and good enough. You will also get a very strong reactive-streams based library with a lot of operators. I can try to confirm it works on Android in the next week. Is that timeframe suitable? This will save you tackling JNI and build issues. That said if you know JNI well, then the rsocket-cpp should be a fairly light dependency to add so it is a very viable option that we know works. Which backends are you considering? |
@yschimke Sorry for the late response. As you said, it'd be very helpful if I could just use rsocket-java on Android. And I definitely want the reactive-streams based library. Plus, I'm not familiar with JNI either. If you can give me some advice on what should I do to use it on Android, I can wait until next week, thanks! Backend will be Java based using rsocket-java, I'm considering rx-netty/reactor. |
If you use TCP or Websocket connectors it builds upon https://github.com/reactor/reactor-netty The issue with Android support is going to be Java 8 support. It's either going to be a use Android Studio 3 (prerelease) with new compiler toolchains etc, or RetroLambda which would be min Android SDK 22 IIUC. But I'll let you know when I've got it working and submit a sample project that hits the public demo server at http://rsocket-demo.herokuapp.com/ |
I looked at both RetroLambda, before switching to Android Studio 3 pre-release which has more real support for Java 8. https://developer.android.com/studio/write/java8-support.html
The awkward answer is that it works awesomely on Android O (26), but I think with a minor API change (avoiding requiring java.time) I can get it working cleanly for 24+. But that is a very small part of the market, so more relevant for an internal app than making your millions on the App Store. rsocket-cpp will be the best bet for support < SDK 24. |
I have no current plans to actually get it working on SDK 24, apart from raising an issue with Reactor asking about their status. Unless they commit to SDK 24 support then I don't think rsocket-java can commit as various APIs will break randomly due to usage or internal changes. |
I'll put up the demo app as it is. I'm following up on reactor-core here reactor/reactor-core#796 |
Unfortunately, I need to support at least SDK 22 so it seems like rsocket-java is not an option for now. Thank you anyways! |
@NexZhu yep - rsocket-cpp works so feel free to file an issue on that project. But I hope they just ask you for a PR instead :) |
@NexZhu There is simpler way now with rsocket-android, working on SDK19 and above. |
@mostroverkhov awesome, cc @robertroeser Do you want to add a link from https://github.com/rsocket/rsocket-java/blob/1.0.x/README.md Robert, how does this fit with your plans? |
@yschimke looking around to find people also interested in RSocket . I think it would be sufficient to pin all implementations of RSocket in organization main page, and move example links into respective repositories. |
@mostroverkhov actually I missed that this is in the rsocket repo anyway, so ignore my question. |
@lexs can you, please provide example of building rsocket-cpp for android for example. I tried with externalNativeBuild { but it does not seem to work. |
I think you could look at https://www.github.com/facebook/flipper/tree/master/android%2Fthird-party%2Fnative.gradle |
Java 8 is supported now on Android down to 21 https://developer.android.com/studio/write/java8-support So worth trying this first |
I've updated this example which seems to be working well https://github.com/rsocket/rsocket-demo-android-java8/blob/master/README.md |
Yes! it is possible to generally use rsocket-java on Android as a client. |
@yschimke is it possible to use rsocket-java in Android below 21? The doc says that multiDexEnabled should be set to true, when setting minSdkVersion to 20 or lower. defaultConfig {
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
} |
Not sure, haven't tried. If it works for you please update here. With rsocket-java and Spring reactor, Android support is best effort. See reactor/reactor-core#2227 which relates to a critical dependency of rsocket-java |
You can also try https://github.com/rsocket/rsocket-kotlin/ not sure what the answer is here |
@dawud-tan better to raise an issue at https://github.com/rsocket/rsocket-kotlin/ mentioning required Java version, etc |
@yschimke To use on Android. What do I need to implement? |
I don't have a recent sample for you. Sorry. I don't know if Netty dependencies are an issue still with rsocket-java on android. But rsocket-kotlin uses Ktor, which does work, instructions in that project docs. |
What are the dependencies of the client part of rsocket-java?
Is it possible to use rsocket-java on Android?
Or maybe rsocket-cpp?
Thanks.
The text was updated successfully, but these errors were encountered: