Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
io.ktor:ktor-websockets-tvosx64
Advanced tools
Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.
Ktor is an asynchronous framework for creating microservices, web applications and more. Written in Kotlin from the ground up.
First add the dependency to your project:
repositories {
mavenCentral()
}
dependencies {
implementation("io.ktor:ktor-server-netty:$ktor_version")
}
Then create an Application
and install some features:
import io.ktor.server.netty.*
import io.ktor.server.routing.*
import io.ktor.server.application.*
import io.ktor.http.*
import io.ktor.server.response.*
import io.ktor.server.engine.*
fun main(args: Array<String>) {
embeddedServer(Netty, 8080) {
routing {
get("/") {
call.respondText("Hello, world!", ContentType.Text.Html)
}
}
}.start(wait = true)
}
You also can use Ktor Gradle Plugin to configure bom, run tasks and deployment:
plugins {
id("io.ktor.plugin") version "3.0.0"
}
dependencies {
implementation("io.ktor:ktor-server-netty")
}
To run the created application, execute:
./gradlew run
localhost:8080
Hello, world!
when receiving a GET http request for the root pathBuild your first Kotlin HTTP or RESTful application using Ktor: start.ktor.io
Ktor Framework doesn't impose a lot of constraints on what technology a project is going to use – logging, templating, messaging, persistence, serialization, dependency injection, etc. Sometimes it may be required to implement a simple interface, but usually it is a matter of writing a transforming or intercepting function. Features are installed into the application using a unified interception mechanism which allows building arbitrary pipelines.
Ktor Applications can be hosted in any servlet container with Servlet 3.0+ API support such as Tomcat, or standalone using Netty or Jetty. Support for other hosts can be added through the unified hosting API.
Ktor APIs are mostly functions calls with lambdas. Thanks to Kotlin DSL capabilities, the code looks declarative. Application composition is entirely up to the developer's choice – with functions or classes, using dependency injection framework or doing it all manually in the main function.
The Ktor pipeline machinery and API are utilising Kotlin coroutines to provide easy-to-use asynchronous programming model without making it too cumbersome. All host implementations are using asynchronous I/O facilities to avoid thread blocking.
Ktor applications can be hosted in a special test environment, which emulates a web server to some extent without actually doing any networking. It provides easy way to test an application without mocking too much stuff, and still achieve good performance while validating application calls. Running integration tests with a real embedded web server are of course possible, too.
Ktor is an official JetBrains product and is primarily developed by the team at JetBrains, with contributions from the community.
Please visit ktor.io for Quick Start and detailed explanations of features, usage and machinery.
Please use our issue tracker for filing feature requests and bugs. If you'd like to ask a question, we recommend StackOverflow where members of the team monitor frequently.
There is also community support on the Kotlin Slack Ktor channel
If you find a security vulnerability in Ktor, we kindly request that you reach out to the JetBrains security team via our responsible disclosure process.
Kotlin web frameworks such as Wasabi and Kara, which are currently deprecated.
Please see the contribution guide and the Code of conduct before contributing.
FAQs
Unknown package
We found that io.ktor:ktor-websockets-tvosx64 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.