:mega: Can you folks share what you like most abo...
# ktor
o
📣 Can you folks share what you like most about Ktor, and what least? Just one-two sentences in a thread. Thinking about what to highlight in the release blog post.
m
It's unopinionated, extensible, and has good support for testing. Also, coroutines! Edit: Oh, and what I like the least: the pipeline structure is sometimes difficult to work with, but most things I've needed to do have worked out. I'm using ktor in production, but my traffic numbers aren't interesting -- low volume, specialized product 🙂
r
I've only used the http client and none of the server-side stuff, so my experience is somewhat limited like most: It's a Kotlin-first solution, which means it takes full advantage of things like DSL syntax, coroutines, and multiplatform. This both makes it neat to use, and makes it a great showcase for styles and idioms that we can use in our own code. like least: Some of the configuration can feel a little too "magical" to me, where I worry that it's hard to intuit about things. For example, the way JsonFeature automatically grabs a default serializer based on what gradle includes you have. But maybe that's because I don't have much experience with it yet.
m
^ seconded that -- I dislike automatic "we scanned your classpath and started using whatever we found" approaches.
(A library I'm using unfortunately manages to depend on jackson 1, jackson 2, gson, AND org.json all at the same time. I don't want any clever logic deciding for me what to use; I want to explicitly define which json library is the right one.)
😱 3
v
a) Extensibility: In Ktor it is easy to add features even when a feature is not built-in. e.g. ignoring in a specific route all calls that come from a specific useragent, in our case API-calls from a released android app with broken API calls. b) Stability and Performance: We use Ktor since 0.2.4 (februar 2017) in production. We handle since then continously 3000 - 4000 request / minute on our server without any problems. c) Built-In application features: We found every generic solution already built-in in Ktor: Compression, Call-Logging while Debugging, HttpsRedirecting, SessionCookies, CORS, Metrics. (Metrics was pointed out to us by @Deactivated User). d) Architecture: Due to its well structured architecture it is quite easy to extend Ktor with custom features. Its very rare to see in the “web”-domain projects that are well architectured. (e.g. without the need of reading the documentation it is perfectly clear how to respond with a redirect (
call.responseRedirect(url)
), repond with a Json
call.respondeText(string, ContentType.Application.Json)
or just get all headers (
call.request.headers
)). e) No “magic”. I use Meteor in another project. Compared with that it is always clear or at least easy to find out with a debugger whats going on in the system. f) Made by the folks at JetBrains. Not only does this mean that I can expect a very high amount of quality, but also while debugging things I often discover new ways of how to express things in kotlin. By reading the source code / architecture of Ktor you can understand how Kotlin is “meant to be”.
s
Likes: Extremely easy to get started with, very well documented, features and the way they are added to the application Dislikes: Routing. I am coming from a framework that uses type safe routing and coming to Ktor I felt really disappointed having to validate my parameters manually in routes and the location feature unfortunately doesn’t really do it either
n
Pros - Easy to use with Ktor not being opinionated and magical . Good documentation 📖 with a very good search system 🔍. Modular system for adding features. DSLs for declaratively building routes/web UIs. Cons - No documentation on developing a full stack web app using Ktor (for back-end), and a Kotlin UI library/toolkit/framework (for front-end which is NOT based on a JS UI framework; could be a Kotlin one based on WASM in the near future, which is an opportunity for collaboration between JB and the Kotlin community). Full stack web app example ( https://github.com/ktorio/ktor-samples/tree/master/mpp/fullstack-mpp ) is too basic (not realistic).
m
I love ktor because it's very simple to use and to extend, provides all the typical use-cases and features (including dead-simple WebSockets), covers both the server- and the client-side but most importantly blends perfectly with coroutines ❤️
v
Do we have a release date already? Does it mean we will be able to get it from jcenter/central soon?
o
We don’t have a date yet, but it will be in central soon, yes.
🎉 2