ktor
In this article, you’ll learn what Ktor is and the benefits of using it. Then you’ll learn how to integrate it into your project. After that, you can read about how to create and execute a Ktor request with code snippets.
在本文中,您将了解什么是Ktor以及使用它的好处。 然后,您将学习如何将其集成到您的项目中。 之后,您可以阅读有关如何使用代码段创建和执行Ktor请求的信息。
The article ends with valuable insights about Ktor. You’ll also find a GitHub Ktor sample repository link at the bottom of this article. Feel free to play around with it.
本文以关于Ktor的宝贵见解结尾。 您还将在本文底部找到GitHub Ktor示例存储库链接。 随便玩吧。
什么是Ktor? (What Is Ktor?)
According to its official website, “Ktor is an open-source framework for building asynchronous servers and clients in connected systems using the powerful Kotlin programming language.” It runs on coroutines and was made by JetBrains.
根据其官方网站 ,“ Ktor是一个开放源代码框架,可使用强大的Kotlin编程语言在连接的系统中构建异步服务器和客户端。” 它在协程上运行,由JetBrains制造 。
Ktor’s aim is to provide an end-to-end multi-platform application. It’s still a WIP. At present, it has JVM, iOS, JavaScript, and Android clients.
Ktor的目标是提供端到端的多平台应用程序。 仍然是在制品。 目前,它具有JVM,iOS,JavaScript和Android客户端。
为什么选择Ktor联网? (Why Ktor for Networking?)
Despite platform-specific clients, if you try to learn how to use the Ktor client in your native platform, you can easily work with Ktor in other platforms.
尽管有特定于平台的客户端,但是如果您尝试学习如何在本机平台上使用Ktor客户端,则可以轻松地在其他平台上使用Ktor。
For example, as an Android developer first, I tried to use it in native Android applications via Ktor’s Android client. This experience helped me to implement Ktor in multi-platform Kotlin projects.
例如,首先作为一名Android开发人员,我尝试通过Ktor的Android客户端在本机Android应用程序中使用它。 这项经验帮助我在多平台Kotlin项目中实施了Ktor。
Under the hood, Ktor uses coroutines for asynchronous programming to keep the