Stupid question incoming: if http4k is a pure kotl...
# http4k
t
Stupid question incoming: if http4k is a pure kotlin framework, why doesn’t it support kotlin/native or js/wasm as targets? Context: I’m looking into enabling our experienced mobile devs to reach and contribute to “the server”. We’re already supporting both Android & iOS platforms with a KMP shared module for business logic, networking & sqlite, so we’re experimenting what’s the smoothest path to enable feature contributions to the server too. We’re using the Ktor client on mobile, but I always had a soft spot for arrow & sane fp patterns so I’m seriously looking at http4k, ktor or smth full-blown like Quarkus. Our current server stack is dotnet-core, don’t ask why 😅.
d
It's not a stupid question - it's actually a matter of practicality. At the moment we are stuck to the JVM because of the lack of actual libraries available to provide a decent level of support. This can broadly be categorised into 3: 1. IO. For a long time, KotlinX IO didn't exist at all so it was impossible to move to it. It exists now but is still on v0.7 (and tagged as Alpha on GitHub - although this may be out of date). 2. Datetimes - I'm pretty sure our API usage of the Java Datetime libraries is wider than KotlinX Datetime and we might have problems with porting all of the functionality that we rely on (Citation needed). Also it is in the same category as KIO (v0.6 and alpha). 3. Misc - this includes crypto libraries and goes as far as things like UrlDecoders - a lot of these things that are provided on the JVM currently have no direct equivalent - and as far as JS/WASM is concerned it's incredibly early days. TBH we have zero interest in writing all of these by hand. This situation will inevitably get better eventually, but a lot of our user base are in finance and similar industries - they use http4k for the rock solid reliability so it's not something we can consider until there are some more mature options. Once these are out of the way, there is a route to making at least the core of http4k work in wider contexts - but quite a lot of our integrations are actually very specific to JVM libraries so you would also end up with something a lot lighter (maybe the core and a few other bits out of the 180 odd modules we currently have). ps. we don't really push it but http4k does work on Android, There are examples here 🙂
🙏 1
t
@dave thanks for the comprehensive response, I really appreciate it. I can’t say I have a real use-case where I want to switch an API atop the JVM to smth like Node, but the question still itched my brain 😄. The other itch (which I know I shouldn’t look at too seriously) is why quarkus is consistently at the top of the teckempower lists, and why http4k keeps trumping ktor :D.