alright, I ll share my bit as well. Since Ktor doe...
# kotlin-native
k
alright, I ll share my bit as well. Since Ktor doesnt (yet) support server on Native, I m creating a library for simple multithreaded http server, based on pure sockets, with dsl for definition of routing. it aleeady supports base64url encoding, rsa key pair and jwt token generation and jwks key sharing.. it is still in draft stage, but it is usable. you can take a look if you are interested. I ll be happy for any feedback/contrib: https://github.com/kubapet/knativesrv/tree/master
❤️ 3
d
Isn't using workers a bit of a performance drawback? I think you could use coroutines and distribute them between workers you keep in a pool or something like that.
k
thanks for input Dario, I was trying it at the beginning but I got stuck on the fact that the C methods like accetp are blocking the whole thread, so it just blocked all other coroutines as well... but maybe there would be a way how to implement it using the select(), I m not that much familiar with this posix socket stuff yet 😬
d
I did something like that once. In POSIX you can use fcntl() to set the socket to non-blocking mode, so when you try a read/write operation you can check for a E_WOULDBLOCK error and suspend instead of blocking. The kotlin/native samples at the official Github repository show a way to use this but it's rather complicated. Anyway good luck!
k
I ll take a look at it, sounds promising. Thanks :)