<@U79JY5TL3> A few colleagues and I are creating a...
# multiplatform
s
@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
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
We don’t have a Kotlin JS site yet.. it is more me thinking about the future 🙂
m
That sounds like a fun project, I've been wanting to write some Kotlin JS for a while now 🙂
s
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
Yep, maybe some kind of coroutines interop too, I'm not sure how much of coroutines is supported in JS
s
Only main-thread
r
Ktor has a JS client so you could probably leverage that or build something similar
👍 3
a
@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
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
I couldn't agree more