https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

streetsofboston

06/25/2020, 8:30 PM
@mbonnin A few colleagues and I are creating a project that has a GraphQL server as backend. Currently, the project is for Android and iOS only. Apollo supports KMP for Android and iOS, so this is great! Thank you and your team! 🙂 But thinking about the future: Does Apollo have plans to support JavaScript (or WebAssembly) for KMP as well? If not, would there be an alternative way to support Apollo Client on the KMP-JS target?
🙌 1
m

mbonnin

06/25/2020, 9:05 PM
That's a very good question and I definitely don't have a very good answer 🙂
It might not be very difficult to add a Javascript target, do you already have a website that could use KotlinJS?
On top of my head, the main platform specific thing is the HTTP client
Which could be implemented in JS. Then there's the question of interfacing with coroutines
s

streetsofboston

06/25/2020, 9:08 PM
We don’t have a Kotlin JS site yet.. it is more me thinking about the future 🙂
m

mbonnin

06/25/2020, 9:08 PM
That sounds like a fun project, I've been wanting to write some Kotlin JS for a while now 🙂
s

streetsofboston

06/25/2020, 9:08 PM
Yeah… I was thinking about how the JS engine (run-time) from Apollo could be used and then hooking it up to KMP.
I’ve been browsing through your repos, through react and react-native, but these are all quite complete solution. The KMP would mostly just need the HTTP client, the HTTP transport for JS, not all the other stuff (eg code generation is already all in Kotlin).
m

mbonnin

06/25/2020, 9:13 PM
Yep, maybe some kind of coroutines interop too, I'm not sure how much of coroutines is supported in JS
s

streetsofboston

06/25/2020, 9:13 PM
Only main-thread
r

russhwolf

06/25/2020, 9:50 PM
Ktor has a JS client so you could probably leverage that or build something similar
👍 3
a

andylamax

06/26/2020, 1:51 AM
@mbonnin Coroutines are well supported in JS and they work as exactly as you'd expect. The only difference is that they all run in the main thread.
👀 1
☝️ 1
p

Peter Hsu

06/28/2020, 11:31 PM
Just to add to this, I am actively working on a project that needs JS/iOS/Android and we are using the latest apollo multiplatform. For the time being, I was planning on rolling a separate implementation for JS, but having apollo kmp export to JS would be amazing!
a

andylamax

06/29/2020, 10:49 AM
I couldn't agree more
2 Views