https://kotlinlang.org logo
#reaktive
Title
# reaktive
w

wellingtoncosta

07/16/2020, 4:04 PM
Hi! How can I use
reaktive
with
ktor
for http calls?
a

Arkadii Ivanov

07/16/2020, 4:11 PM
Hello! Please read the following section of the README: https://github.com/badoo/Reaktive#coroutines-interop In general, Ktor crashes in multi-threaded environment. Assuming you are using the full multi-threading power of Reaktive, it's quite easy to freeze Ktor Client by accident in Kotlin/Native, so it will crash. I really recommend to avoid using Ktor currently and replace with a simple expect/actual. But if you have to use Ktor, then you can try the provided in the README "unsafe" solution.
👍 1
s

saket

07/16/2020, 4:15 PM
is there an issuetracker page for this that I can follow on ktor’s github?
w

wellingtoncosta

07/16/2020, 4:18 PM
Hello, Arkadii! I read this section, but it wasn’t clear to me. Now I confirmed what I had understood. In this case, I need to implement my networking layer using the standard HTTP API of the target (
HttpUrlConnection
for Java / Kotlin and
NSURLConnection
for iOS)?
a

Arkadii Ivanov

07/16/2020, 4:25 PM
Yes this would be a perfect solution from my point of view! You can derive your implementation from my article: https://badootech.badoo.com/mvi-in-kotlin-multiplatform-part-2-2-of-3-3faab535de02?source=friends_link&sk=a7a347e49202e139d5cd7533d2a97141 Checkout the "Implementing KittenDataSource" section.
👍 1
s

saket

07/16/2020, 4:36 PM
this is such a nice illustration
w

wellingtoncosta

07/16/2020, 4:36 PM
Thanks @Arkadii Ivanov!
s

saket

07/16/2020, 4:37 PM
For Android we are using HttpUrlConnection, again this is a popular way of loading data in Android.
@Arkadii Ivanov I don’t think anyone
HttpUrlConnection
anymore :p
a

Arkadii Ivanov

07/16/2020, 5:00 PM
@saket
this is such a nice illustration
Thanks! We were working hard on this)))
I don’t think anyone 
HttpUrlConnection
 anymore
Well, I think this is the common way for low level networking, isn't it? Of course you can use Retrofit or other frameworks :-)
s

saket

07/16/2020, 5:01 PM
right everyone uses some abstraction on top of httpurlconnection
@Arkadii Ivanov can badoo release a high-res version of this illustration by any chances? It’d make for a good wallpaper.
a

Arkadii Ivanov

07/16/2020, 5:02 PM
I will ask!
Viola!
Sorry for spamming :-)
s

saket

07/16/2020, 5:05 PM
Awesome. Any chances
part 1
and
business logic
be removed/changed? They’d look weird in wallpapers lol.
a

Arkadii Ivanov

07/16/2020, 5:10 PM
Will PM you
3 Views