Has there been any work/interest to get ktor to ru...
# ktor
k
Has there been any work/interest to get ktor to run on kotlin native?
g
Some work yes, for example CIO
But it’s not ready yet for MPP, probably if you have good use cases for MPP server you could report them to ktro issue tracker
k
What does MPP stand for?
And how does CIO get them closer to running natively?
Does it replace NIO that's provided via netty?;
g
MPP is Multi Platform Project
CIO is Coroutines IO, this is server engine for Kyor written from scratch and based on Coroutines and Kotlinx.io library. It still requires some JVM dependencies, but in future may become Multiplatform
CIO replaces netty/Apache/jetty engines, neither of them can be used for native/Multiplatform, only for JVM
Most probably the engine is not only JVM dependency, Ktor itself also should be migrated, but I think the engine (io, sockets, http stack, websockets, cryptography etc) is the biggest problem
k
Interesting okay. Thanks for the insight
I'm looking for something a little more lightweight than the JVM since what I'm developing is intended to be a self hosted service. It doesn't require a lot of throughput, so the ability to sacrifice performance for resources is one that I would like to make
And I would prefer using kotlin over another language to keep the language overhead for every platform as minimal as possible to attract contributors
g
If you really look some very small solution, you can check example for K/N that uses libmicrohttpd
It’s quite outdated, but shows general idea
But if you want to to find contributors I would stick with JVM 😀
Also nothing prevents you from usage of any node.js server library (or with no library, just using default http module) with Kotlin JS
e
Client works great on MPP. Server works…not at all.
(great modulo LOL coroutines on Native, but that’s more a Coroutines problem than a ktor problem)
g
Not sure that it is correct. Coroutines work on native already: suspend functions, structured concurrency, channels, runBlockong etc no native multithreading in Coroutines, but In general by itself is not a blocker (and for example all JS servers are single threaded) Ktor has quite a lot of features, many of them based on JVM libraries and APIs, so I think Ktor itself, and many components of Ktor, such as http engine, cryptography, sockets, file io etc are bigger problems than Coroutines or Kotlinx.coroutines for MPP
e
Fair point, I meant more in terms of having them work differently on JVM vs Native clients, and Native having to work with the freezing stuff, which can be a bit to wrap your head around.
g
Yeah, but only if multithreading involved, which is not always the case for web server
e
True, much more of an issue on iOS