Implementation("io.ktor:ktor-server-netty-jvm:$ktor_version") Val isDevelopment: Boolean = ("development")ĪpplicationDefaultJvmArgs = listOf("=$isDevelopment") We'll use the CIO Ktor HTTP client but you can use any other web engine for the HTTP client. We'll need a client to send requests to Space. Ktor HTTP client: a generic Ktor app doesn't reference libraries for HTTP client. The snippets always reference the latest available version of the SDK.įasterXML/jackson: to work with JSON payloads. This will open a window with snippets for Gradle and Maven. On the right, in the list under Code, select Kotlin SDK and click Set up dependency. To get the instructions on how to reference the latest SDK, open API Playground in your Space instance ( Extensions | API Playground). Our chatbot requires the following libraries: That's it! Now, we have a blank Ktor project. We're not going to install any Ktor plugins, so, on the next page just click Create. Specify a project Name and a Website name, select Gradle Kotlin in Build System, and clear the Add sample code checkbox.Ĭlick Next. Start creating a new project with File | New | Project. An open and publicly-available port on your computer poses a serious security threat. Do not use it to host the chatbot on your computer on regular basis. We strongly recommend that you use a tunnelling service only for testing purposes during development. For our purposes, the free plan for ngrok or PageKyte is enough. To start working with the tunneling service, you should download a service client: ngrok client, PageKyte client. For example, you can use ngrok, PageKyte, or another tunnelling service for this purpose. It will let us run our chatbot locally and access it from Space via a public URL (we'll specify it as the chatbot's endpoint). Such a service exposes local servers to the public internet. As well as the Ktor framework, we'll get the SDK as a Gradle dependency. The SDK contains the HTTP API client that lets you easily authenticate in and communicate with Space by using multiple high-level classes. To ease the life of Space app developers, we provide Space SDK for Kotlin and. Of course, outside of this tutorial, you can create a Space bot using any web framework you like, e.g., Node.js, ASP.NET, and so on.Īs you might know from the Develop Applications topic, any application must communicate with Space using Space HTTP API. We'll get it as one of Gradle dependencies, so, no additional actions are required from your side. This is a framework that lets you easily create all types of connected applications, e.g., servers, clients, mobile, and browser-based apps. So, you can use any IDE of your choice, but this tutorial implies that you use IntelliJ IDEA.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |