hello everyone :slightly_smiling_face: I am attemp...
# server
f
hello everyone 🙂 I am attempting to make with kotlin a desktop application that listens to port(s) for messages and returns responses (i.e. input output). It will only be handling requests from host user (from web browser). This seems like a tcp/ip application. I want to make this as lightweight as possible. From these requirements, ktor seems like possibly overkill for library choice . Using a jetty (not netty) or cio (avoiding http layer) seems like the most lightweight options . But maybe I should avoid ktor all together because it would be great to not use a servlet. My first solution (for mvp) was just a while loop that listens for messages on ports, and then I deserialized with code I wrote, etc. So what I am looking for is a library that could do this (that I wont have to maintain, and is hopefuly better then just a while loop) that does not use a servlet (because It is over kill)
a
Http4k has a small 1 MB core module and can use the
SunHttp
server built into the java runtime. Might be worth looking into! https://www.http4k.org/blog/nanoservices/
My first solution (for mvp) was just a while loop that listens for messages on ports, and then I deserialized with code I wrote, etc.
Believe it or not, but I have actually seen this in production code. You may not mind the missing features of this approach, but the effort required to get and write the content you need and ensure it's robust might not be worth it.
d
We use sunhttp for low traffic servers for logging in CLI callbacks
It's works great and is really lightweight
f
thanks @Andrew O'Hara and @dave
c
I recommend vert.x if you want something low level
f
@christophsturm would vert.x not be best suited for cloud / real distributed servers? not just a single node desktop server/application
c
you said you are currently using a while loop so vertx with its event loop could be just perfect. and its not a huge library, sure it its mostly for servers but good performance is always great on the client 🙂
👍 1
f
ok this is an interesting choice, definately will look into it and do some performance comparisons with simple example