Skip to content
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

Kotlin Flow? #368

Open
ychescale9 opened this issue Aug 25, 2019 · 9 comments
Open

Kotlin Flow? #368

ychescale9 opened this issue Aug 25, 2019 · 9 comments

Comments

@ychescale9
Copy link
Contributor

ychescale9 commented Aug 25, 2019

Hi @pwittchen, now that Kotlin Coroutines Flow is stable, I'm wondering if there's any interest / plans to migrate the project to kotlin and expose Flow in the APIs (or just your thoughts in general).

I'm aware that this is a RxJava project and you're also planning to support RxJava 3 so this might be out of scope for ReactiveNetwork. But there are a couple of reasons I still want to raise this issue:

  • It's called ReactiveNetwork and not something like RxNetwork. I don't know maybe just because the name was taken? 😃
  • It's useful because it provides reactive network change events through cold streams which fits well within a reactive / push-based architecture. I see RxJava as a layer of binding APIs for RxJava users, and there should be options for Kotlin Flow users.
  • Generally I'd like to see the ecosystem move forward. I'm not here to pitch for replacing RxJava with Coroutines and I love RxJava and all its crazy operators. But Flow and Coroutines are getting tractions with first-class support from Kotlin / Jetbrains / Google (Lifecycle already supports Coroutines, Room supports Flow in latest alpha, and Paging 3.0 is being re-written in Kotlin with Coroutines and Flow).

A few options I have in mind:

  • Re-write in Kotlin and Flow in separate branch (no RxJava dependency)
  • Provide extension artifact for exposing Flow type instead of Rx Obsersvable
  • Do nothing (maybe start a new repo) 😄

Regardless of what you think about this I'm still extremely grateful for the work you've put into this great library.

@pwittchen
Copy link
Owner

pwittchen commented Aug 25, 2019

Hi @ychescale9 and thanks for your extensive feedback!

It's called ReactiveNetwork and not something like RxNetwork. I don't know maybe just because the name was taken? smiley

I used this name to indicate that library is using ReactiveExtensions and ReactiveStreams. There are other libraries with Reactive name prefix, which uses RxJava. I heard about similar projects called RxNetwork, etc. As long as I as own package name com.github.pwittchen I can release artifacts to Maven Central with any name under this package. People know this project under ReactiveNetwork name, which tells what library does, so I prefer to keep it even if RxNetwork could be a better idea for a name :)

  • It's useful because it provides reactive network change events through cold streams which fits well within a reactive / push-based architecture. I see RxJava as a layer of binding APIs for RxJava users, and there should be options for Kotlin Flow users.
  • Generally I'd like to see the ecosystem move forward. I'm not here to pitch for replacing RxJava with Coroutines and I love RxJava and all its crazy operators. But Flow and Coroutines are getting tractions with first-class support from Kotlin / Jetbrains / Google (Lifecycle already supports Coroutines, Room supports Flow in latest alpha, and Paging 3.0 is being re-written in Kotlin with Coroutines and Flow).

That's good idea!

A few options I have in mind:

  • Re-write in Kotlin and Flow in separate branch (no RxJava dependency)
  • Provide extension artifact for exposing Flow type instead of Rx Obsersvable
  • Do nothing (maybe start a new repo) :)

Right now, RxJava is tightly coupled to this library and project heavily relies on it. I think, starting a new repo and keeping this project as a reference with ideas for development would be the best option. Coroutines are slightly different concept than reactive programming. Moreover, coroutines are available in Kotlin only and this project provides support both for Java and Kotlin users. When I find some time, I consider preparing project like that, because it'd be interesting to develop it, but I cannot promise any specific release dates, etc.

Regardless of what you think about this I'm still extremely grateful for the work you've put into this great library.

Great to hear that you find it useful! Thanks! :)

@ychescale9
Copy link
Contributor Author

Thanks @pwittchen that all makes sense. In that case I'd like to take a shot at porting ReactiveNetwork to Flow in a new repo. Will ping you for feedback / insight if you're cool with this 😄

@pwittchen
Copy link
Owner

Sure :)

@phansier
Copy link

phansier commented May 2, 2020

@ychescale9 did you manage to do porting? Or maybe did you find any existing analogues based on Kotlin Flow?

@ychescale9
Copy link
Contributor Author

I haven’t found the time to do it yet but hoping to get to it soon. I’ll probably do a prototype here and then move it to a proper library later.

@phansier
Copy link

@ychescale9 @pwittchen I've made a port by myself: https://github.com/AndreySBer/FlowReactiveNetwork
Please use it. Any help or issues are welcome.

@pwittchen
Copy link
Owner

Great! Thanks for the update.

@lion4ik
Copy link

lion4ik commented Jul 13, 2020

Oh, guys I have also done the same port https://github.com/lion4ik/NetworkFlow

@ychescale9
Copy link
Contributor Author

@lion4ik thanks!

Since there are a couple of alternatives now (and there’ll be more to come) I think we can close the issue now😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants