https://kotlinlang.org logo
#ktor
Title
# ktor
k

kevin.cianfarini

03/28/2019, 11:51 PM
Has there been any work/interest to get ktor to run on kotlin native?
g

gildor

03/29/2019, 5:00 AM
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

kevin.cianfarini

03/29/2019, 12:16 PM
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

gildor

03/29/2019, 1:13 PM
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

kevin.cianfarini

03/29/2019, 1:59 PM
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

gildor

03/29/2019, 2:06 PM
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

Ellen Shapiro

04/02/2019, 1:28 PM
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

gildor

04/02/2019, 1:48 PM
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

Ellen Shapiro

04/03/2019, 10:02 AM
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

gildor

04/03/2019, 10:07 AM
Yeah, but only if multithreading involved, which is not always the case for web server
e

Ellen Shapiro

04/04/2019, 9:10 AM
True, much more of an issue on iOS
2 Views